/*!
Parts of this script are from the TurboWarp Packager <https://packager.turbowarp.org/>, licensed as follows:
Copyright (C) 2021-2024 Thomas Weber

The Source Code Form of this program is available under the terms of the
Mozilla Public License, v. 2.0. You can obtain a copy of the license at
https://www.mozilla.org/en-US/MPL/2.0/.

Parts of this script are from Scratch <https://scratch.mit.edu/>, licensed as follows:
Copyright (c) 2016, Massachusetts Institute of Technology
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/*! For license information please see scaffolding-min.js.LICENSE.txt */
!function(t){function e(e){for(var n,i,s=e[0],o=e[1],a=0,u=[];a<s.length;a++)i=s[a],Object.prototype.hasOwnProperty.call(r,i)&&r[i]&&u.push(r[i][0]),r[i]=0;for(n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n]);for(c&&c(e);u.length;)u.shift()()}var n={},r={0:0};function i(e){if(n[e])return n[e].exports;var r=n[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(t){var e=[],n=r[t];if(0!==n)if(n)e.push(n[2]);else{var s=new Promise((function(e,i){n=r[t]=[e,i]}));e.push(n[2]=s);var o,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(t){return i.p+"scaffolding/"+({1:"vendors~iframe-extension-worker"}[t]||t)+".js"}(t);var c=new Error;o=function(e){a.onerror=a.onload=null,clearTimeout(u);var n=r[t];if(0!==n){if(n){var i=e&&("load"===e.type?"missing":e.type),s=e&&e.target&&e.target.src;c.message="Loading chunk "+t+" failed.\n("+i+": "+s+")",c.name="ChunkLoadError",c.type=i,c.request=s,n[1](c)}r[t]=void 0}};var u=setTimeout((function(){o({type:"timeout",target:a})}),12e4);a.onerror=a.onload=o,document.head.appendChild(a)}return Promise.all(e)},i.m=t,i.c=n,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i.oe=function(t){throw console.error(t),t};var s=window.webpackJsonp=window.webpackJsonp||[],o=s.push.bind(s);s.push=e,s=s.slice();for(var a=0;a<s.length;a++)e(s[a]);var c=o;i(i.s=295)}([function(t,e,n){const r=n(27);r.enable(),t.exports=r("vm")},function(t,e,n){const r=n(20),i=t=>{if("string"!=typeof t)return!1;for(let e=0;e<t.length;e++){const n=t.charCodeAt(e);if(48===n||9===n)return!1}return!0};class s{static toNumber(t){if("number"==typeof t)return Number.isNaN(t)?0:t;const e=Number(t);return Number.isNaN(e)?0:e}static toBoolean(t){return"boolean"==typeof t?t:"string"==typeof t?""!==t&&"0"!==t&&"false"!==t.toLowerCase():Boolean(t)}static toString(t){return String(t)}static toRgbColorList(t){const e=s.toRgbColorObject(t);return[e.r,e.g,e.b]}static toRgbColorObject(t){let e;return"string"==typeof t&&"#"===t.substring(0,1)?(e=r.hexToRgb(t),e||(e={r:0,g:0,b:0,a:255})):e=r.decimalToRgb(s.toNumber(t)),e}static isWhiteSpace(t){return null===t||"string"==typeof t&&0===t.trim().length}static compare(t,e){let n=Number(t),r=Number(e);if(0===n&&i(t)?n=NaN:0===r&&i(e)&&(r=NaN),isNaN(n)||isNaN(r)){const n=String(t).toLowerCase(),r=String(e).toLowerCase();return n<r?-1:n>r?1:0}return n===1/0&&r===1/0||n===-1/0&&r===-1/0?0:n-r}static isInt(t){return"number"==typeof t?!!isNaN(t)||t===Math.floor(t):"boolean"==typeof t||"string"==typeof t&&t.indexOf(".")<0}static get LIST_INVALID(){return"INVALID"}static get LIST_ALL(){return"ALL"}static toListIndex(t,e,n){if("number"!=typeof t){if("all"===t)return n?s.LIST_ALL:s.LIST_INVALID;if("last"===t)return e>0?e:s.LIST_INVALID;if("random"===t||"any"===t)return e>0?1+Math.floor(Math.random()*e):s.LIST_INVALID}return(t=Math.floor(s.toNumber(t)))<1||t>e?s.LIST_INVALID:t}}t.exports=s},function(t,e){t.exports={BOOLEAN:"Boolean",BUTTON:"button",LABEL:"label",COMMAND:"command",CONDITIONAL:"conditional",EVENT:"event",HAT:"hat",LOOP:"loop",REPORTER:"reporter",XML:"xml"}},function(t,e){t.exports={ANGLE:"angle",BOOLEAN:"Boolean",COLOR:"color",NUMBER:"number",STRING:"string",MATRIX:"matrix",NOTE:"note",IMAGE:"image",COSTUME:"costume",SOUND:"sound"}},function(t,e){t.exports=class{static degToRad(t){return t*Math.PI/180}static radToDeg(t){return 180*t/Math.PI}static clamp(t,e,n){return Math.min(Math.max(t,e),n)}static wrapClamp(t,e,n){const r=n-e+1;return t-Math.floor((t-e)/r)*r}static tan(t){switch(t%=360){case-270:case 90:return 1/0;case-90:case 270:return-1/0;default:return Math.round(1e10*Math.tan(Math.PI*t/180))/1e10}}static reducedSortOrdering(t){const e=t.slice(0).sort(((t,e)=>t-e));return t.map((t=>e.indexOf(t)))}static inclusiveRandIntWithout(t,e,n){const r=e-t,i=t+Math.floor(Math.random()*r);return i>=n?i+1:i}static scale(t,e,n,r,i){return(t-e)/(n-e)*(i-r)+r}}},function(t,e,n){"use strict";var r=n(106),i=n(107),s=n(57),o=n(56),a=n(55);function c(t,e){return Object.keys(e).forEach((function(n){t[n]=e[n]})),t}t.exports=function t(){var e=c({},a),n="en",u={},l=function(t){return t},h=null,d="warning",p={};function f(t,e,s){var o="string"==typeof t?t:t.default,a=b(o,"object"==typeof t&&t.id||l(o),s||n);return(a.format||(a.format=i(r(a.message),s||n,p)))(e)}f.rich=function(t,e,s){var o="string"==typeof t?t:t.default,a=b(o,"object"==typeof t&&t.id||l(o),s||n);return(a.toParts||(a.toParts=i.toParts(r(a.message,{tagsType:m}),s||n,p)))(e)};var m="<>";function g(t,e){var n=t[2];return function(t,e){var r="object"==typeof n?function(t,e){return Object.keys(t).reduce((function(n,r){return n[r]=t[r](e),n}),{})}(n,e):n;return"function"==typeof t?t(r):t}}function b(t,e,n){var r=o(n,u)||"en",i=u[r]||(u[r]={}),s=i[e];if("string"==typeof s&&(s=i[e]={message:s}),!s){var a='Translation for "'+e+'" in "'+r+'" is missing';if("warning"===d)"undefined"!=typeof console&&console.warn(a);else if("ignore"!==d)throw new Error(a);var c="function"==typeof h?h(t,e,r)||t:h||t;s=i[e]={message:c}}return s}function y(t,e,r,i,a){"object"==typeof r&&"object"!=typeof i&&(a=i,i=r,r=0);var c=o(a||n,s),u=c&&s[c][t]||v;return i["="+ +e]||i[u(e-r)]||i.other}function v(){return"other"}return p[m]=g,f.setup=function(t){return(t=t||{}).locale&&(n=t.locale),"translations"in t&&(u=t.translations||{}),t.generateId&&(l=t.generateId),"missingReplacement"in t&&(h=t.missingReplacement),t.missingTranslation&&(d=t.missingTranslation),t.formats&&(t.formats.number&&c(e.number,t.formats.number),t.formats.date&&c(e.date,t.formats.date),t.formats.time&&c(e.time,t.formats.time)),t.types&&((p=t.types)[m]=g),{locale:n,translations:u,generateId:l,missingReplacement:h,missingTranslation:d,formats:e,types:p}},f.number=function(t,r,i){var s=r&&e.number[r]||e.parseNumberPattern(r)||e.number.default;return new Intl.NumberFormat(i||n,s).format(t)},f.date=function(t,r,i){var s=r&&e.date[r]||e.parseDatePattern(r)||e.date.default;return new Intl.DateTimeFormat(i||n,s).format(t)},f.time=function(t,r,i){var s=r&&e.time[r]||e.parseDatePattern(r)||e.time.default;return new Intl.DateTimeFormat(i||n,s).format(t)},f.select=function(t,e){return e[t]||e.other},f.custom=function(t,e,n,r){return t[1]in p?p[t[1]](t,e)(n,r):n},f.plural=y.bind(null,"cardinal"),f.selectordinal=y.bind(null,"ordinal"),f.namespace=t,f}()},function(t,e,n){const r=n(0);class i{static withoutTrailingDigits(t){let e=t.length-1;for(;e>=0&&"0123456789".indexOf(t.charAt(e))>-1;)e--;return t.slice(0,e+1)}static unusedName(t,e){if(e.indexOf(t)<0)return t;t=i.withoutTrailingDigits(t);let n=2;for(;e.indexOf(t+n)>=0;)n++;return t+n}static caseInsensitiveUnusedName(t,e){const n=t=>e.some((e=>e.toLowerCase()===t.toLowerCase()));if(!n(t))return t;t=i.withoutTrailingDigits(t);let r=2;for(;n("".concat(t).concat(r));)r++;return"".concat(t).concat(r)}static splitFirst(t,e){const n=t.indexOf(e);return n>=0?[t.substring(0,n),t.substring(n+1)]:[t,null]}static stringify(t){return JSON.stringify(t,((t,e)=>"number"!=typeof e||e!==1/0&&e!==-1/0&&!isNaN(e)?e:0))}static replaceUnsafeChars(t){if("string"!=typeof t){if(!Array.isArray(t))return r.error("Unexpected input recieved in replaceUnsafeChars"),t;t=String(t)}return t.replace(/[<>&'"]/g,(t=>{switch(t){case"<":return"lt";case">":return"gt";case"&":return"amp";case"'":return"apos";case'"':return"quot"}}))}}t.exports=i},function(t,e){const n="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";t.exports=function(){const t=n.length,e=[];for(let r=0;r<20;r++)e[r]=n.charAt(Math.random()*t);return e.join("")}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){const r=n(7),i=n(29);class s{constructor(t,e,n,i){switch(this.id=t||r(),this.name=e,this.type=n,this.isCloud=i,this.type){case s.SCALAR_TYPE:this.value=0;break;case s.LIST_TYPE:this.value=[];break;case s.BROADCAST_MESSAGE_TYPE:this.value=this.name;break;default:throw new Error("Invalid variable type: ".concat(this.type))}}toXML(t){return t=!0===t,'<variable type="'.concat(this.type,'" id="').concat(this.id,'" islocal="').concat(t,'" iscloud="').concat(this.isCloud,'">').concat(i(this.name),"</variable>")}static get SCALAR_TYPE(){return""}static get LIST_TYPE(){return"list"}static get BROADCAST_MESSAGE_TYPE(){return"broadcast_msg"}}t.exports=s},function(t,e,n){var r;"undefined"!=typeof self&&self,r=function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=9)}([function(t,e,n){"use strict";e.__esModule=!0,e.copyExistingProperties=function(t,e){Object.keys(e).forEach((function(n){e.hasOwnProperty(n)&&t.hasOwnProperty(n)&&(e[n]=t[n])}))},e.copyNamedProperties=function(t,e,n){t.forEach((function(t){var r=e[t];void 0!==r&&(n[t]=r)}))},e.isBuffer=function(t,e){return o||(o=t.createBuffer()),e instanceof o.constructor},e.isRenderbuffer=function(t,e){return a||(a=t.createRenderbuffer()),e instanceof a.constructor},e.isShader=function(t,e){return c||(c=t.createShader(t.VERTEX_SHADER)),e instanceof c.constructor},e.isTexture=function(t,e){return u||(u=t.createTexture()),e instanceof u.constructor},e.isSampler=function(t,e){if(!l){if(!t.createSampler)return!1;l=t.createSampler()}return e instanceof l.constructor},e.warn=e.error=void 0;var r,i=(r=n(2))&&r.__esModule?r:{default:r},s=i.default.console&&i.default.console.error&&"function"==typeof i.default.console.error?i.default.console.error.bind(i.default.console):function(){};e.error=s;var o,a,c,u,l,h=i.default.console&&i.default.console.warn&&"function"==typeof i.default.console.warn?i.default.console.warn.bind(i.default.console):function(){};e.warn=h},function(t,e,n){"use strict";e.__esModule=!0,e.getGLTypeForTypedArray=function(t){if(t instanceof Int8Array)return s;if(t instanceof Uint8Array)return o;if(t instanceof Uint8ClampedArray)return o;if(t instanceof Int16Array)return a;if(t instanceof Uint16Array)return c;if(t instanceof Int32Array)return u;if(t instanceof Uint32Array)return l;if(t instanceof Float32Array)return h;throw"unsupported typed array type"},e.getGLTypeForTypedArrayType=function(t){if(t===Int8Array)return s;if(t===Uint8Array)return o;if(t===Uint8ClampedArray)return o;if(t===Int16Array)return a;if(t===Uint16Array)return c;if(t===Int32Array)return u;if(t===Uint32Array)return l;if(t===Float32Array)return h;throw"unsupported typed array type"},e.getTypedArrayTypeForGLType=function(t){var e=d[t];if(!e)throw"unknown gl type";return e},e.isArrayBuffer=void 0;var r,i=(r=n(2))&&r.__esModule?r:{default:r},s=5120,o=5121,a=5122,c=5123,u=5124,l=5125,h=5126,d={},p=d;p[s]=Int8Array,p[o]=Uint8Array,p[a]=Int16Array,p[c]=Uint16Array,p[u]=Int32Array,p[l]=Uint32Array,p[h]=Float32Array,p[32819]=Uint16Array,p[32820]=Uint16Array,p[33635]=Uint16Array,p[5131]=Uint16Array,p[33640]=Uint32Array,p[35899]=Uint32Array,p[35902]=Uint32Array,p[36269]=Uint32Array,p[34042]=Uint32Array;var f=i.default.SharedArrayBuffer?function(t){return t&&t.buffer&&(t.buffer instanceof ArrayBuffer||t.buffer instanceof i.default.SharedArrayBuffer)}:function(t){return t&&t.buffer&&t.buffer instanceof ArrayBuffer};e.isArrayBuffer=f},function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r=void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};e.default=r},function(t,e,n){"use strict";e.__esModule=!0,e.add=function(t,e,n){return(n=n||new r(3))[0]=t[0]+e[0],n[1]=t[1]+e[1],n[2]=t[2]+e[2],n},e.copy=function(t,e){return(e=e||new r(3))[0]=t[0],e[1]=t[1],e[2]=t[2],e},e.create=function(t,e,n){var i=new r(3);return t&&(i[0]=t),e&&(i[1]=e),n&&(i[2]=n),i},e.cross=function(t,e,n){n=n||new r(3);var i=t[2]*e[0]-t[0]*e[2],s=t[0]*e[1]-t[1]*e[0];return n[0]=t[1]*e[2]-t[2]*e[1],n[1]=i,n[2]=s,n},e.distance=function(t,e){var n=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2];return Math.sqrt(n*n+r*r+i*i)},e.distanceSq=function(t,e){var n=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2];return n*n+r*r+i*i},e.divide=function(t,e,n){return(n=n||new r(3))[0]=t[0]/e[0],n[1]=t[1]/e[1],n[2]=t[2]/e[2],n},e.divScalar=function(t,e,n){return(n=n||new r(3))[0]=t[0]/e,n[1]=t[1]/e,n[2]=t[2]/e,n},e.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},e.lerp=function(t,e,n,i){return(i=i||new r(3))[0]=(1-n)*t[0]+n*e[0],i[1]=(1-n)*t[1]+n*e[1],i[2]=(1-n)*t[2]+n*e[2],i},e.length=function(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])},e.lengthSq=function(t){return t[0]*t[0]+t[1]*t[1]+t[2]*t[2]},e.mulScalar=function(t,e,n){return(n=n||new r(3))[0]=t[0]*e,n[1]=t[1]*e,n[2]=t[2]*e,n},e.multiply=function(t,e,n){return(n=n||new r(3))[0]=t[0]*e[0],n[1]=t[1]*e[1],n[2]=t[2]*e[2],n},e.negate=function(t,e){return(e=e||new r(3))[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e},e.normalize=function(t,e){e=e||new r(3);var n=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=Math.sqrt(n);return i>1e-5?(e[0]=t[0]/i,e[1]=t[1]/i,e[2]=t[2]/i):(e[0]=0,e[1]=0,e[2]=0),e},e.setDefaultType=function(t){var e=r;return r=t,e},e.subtract=function(t,e,n){return(n=n||new r(3))[0]=t[0]-e[0],n[1]=t[1]-e[1],n[2]=t[2]-e[2],n};var r=Float32Array},function(t,e,n){"use strict";e.__esModule=!0,e.isWebGL1=function(t){return!t.texStorage2D},e.isWebGL2=function(t){return!!t.texStorage2D},e.glEnumToString=void 0;var r,i,s=(r={},i={},function(t,e){return function(t){var e=t.constructor.name;if(!r[e]){for(var n in t)if("number"==typeof t[n]){var s=i[t[n]];i[t[n]]=s?"".concat(s," | ").concat(n):n}r[e]=!0}}(t),i[e]||"0x"+e.toString(16)});e.glEnumToString=s},function(t,e,n){"use strict";e.__esModule=!0,e.createAttributeSetters=K,e.createProgram=L,e.createProgramFromScripts=function(t,e,n,r,i){for(var s=C(n,r,i),o=[],a=0;a<e.length;++a){var c=B(t,e[a],t[R[a]],s.errorCallback);if(!c)return null;o.push(c)}return L(t,o,s)},e.createProgramFromSources=U,e.createProgramInfo=function(t,e,n,r,i){var s=C(n,r,i),o=!0;if(e=e.map((function(t){if(t.indexOf("\n")<0){var e=l(t);e?t=e.text:(s.errorCallback("no element with id: "+t),o=!1)}return t})),!o)return null;var a=U(t,e,s);return a?Q(t,a):null},e.createProgramInfoFromProgram=Q,e.createUniformSetters=F,e.createUniformBlockSpecFromProgram=G,e.createUniformBlockInfoFromProgram=H,e.createUniformBlockInfo=function(t,e,n){return H(t,e.program,e.uniformBlockSpec,n)},e.createTransformFeedback=function(t,e,n){var r=t.createTransformFeedback();return t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,r),t.useProgram(e.program),V(t,e,n),t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),function(t,e,n){for(var r in e.transformFeedbackInfo&&(e=e.transformFeedbackInfo),n.attribs&&(n=n.attribs),n){var i=e[r];i&&t.bindBufferBase(t.TRANSFORM_FEEDBACK_BUFFER,i.index,null)}}(t,e,n),r},e.createTransformFeedbackInfo=z,e.bindTransformFeedbackInfo=V,e.setAttributes=q,e.setBuffersAndAttributes=function(t,e,n){n.vertexArrayObject?t.bindVertexArray(n.vertexArrayObject):(q(e.attribSetters||e,n.attribs),n.indices&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n.indices))},e.setUniforms=function t(e,n){for(var r=e.uniformSetters||e,i=arguments.length,s=1;s<i;++s){var o=arguments[s];if(Array.isArray(o))for(var a=o.length,c=0;c<a;++c)t(r,o[c]);else for(var u in o){var l=r[u];l&&l(o[u])}}},e.setUniformBlock=function(t,e,n){W(t,e,n)&&t.bufferData(t.UNIFORM_BUFFER,n.array,t.DYNAMIC_DRAW)},e.setBlockUniforms=function(t,e){var n=t.uniforms;for(var r in e){var i=n[r];if(i){var s=e[r];s.length?i.set(s):i[0]=s}}},e.bindUniformBlock=W;var r,i=a(n(4)),s=a(n(0)),o=(r=n(2))&&r.__esModule?r:{default:r};function a(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}var c=s.error,u=s.warn,l=o.default&&o.default.document&&o.default.document.getElementById?o.default.document.getElementById.bind(o.default.document):function(){return null},h=3553,d=34067,p=32879,f=35866,m={};function g(t,e){return m[e].bindPoint}function b(t,e){return function(n){t.uniform1i(e,n)}}function y(t,e){return function(n){t.uniform1iv(e,n)}}function v(t,e){return function(n){t.uniform2iv(e,n)}}function w(t,e){return function(n){t.uniform3iv(e,n)}}function T(t,e){return function(n){t.uniform4iv(e,n)}}function E(t,e,n,r){var o=g(0,e);return i.isWebGL2(t)?function(e){var i,a;s.isTexture(t,e)?(i=e,a=null):(i=e.texture,a=e.sampler),t.uniform1i(r,n),t.activeTexture(t.TEXTURE0+n),t.bindTexture(o,i),t.bindSampler(n,a)}:function(e){t.uniform1i(r,n),t.activeTexture(t.TEXTURE0+n),t.bindTexture(o,e)}}function A(t,e,n,r,o){for(var a=g(0,e),c=new Int32Array(o),u=0;u<o;++u)c[u]=n+u;return i.isWebGL2(t)?function(e){t.uniform1iv(r,c),e.forEach((function(e,r){var i,o;t.activeTexture(t.TEXTURE0+c[r]),s.isTexture(t,e)?(i=e,o=null):(i=e.texture,o=e.sampler),t.bindSampler(n,o),t.bindTexture(a,i)}))}:function(e){t.uniform1iv(r,c),e.forEach((function(e,n){t.activeTexture(t.TEXTURE0+c[n]),t.bindTexture(a,e)}))}}function k(t,e){return function(n){t.bindBuffer(t.ARRAY_BUFFER,n.buffer),t.enableVertexAttribArray(e),t.vertexAttribPointer(e,n.numComponents||n.size,n.type||t.FLOAT,n.normalize||!1,n.stride||0,n.offset||0),void 0!==n.divisor&&t.vertexAttribDivisor(e,n.divisor)}}function I(t,e){return function(n){t.bindBuffer(t.ARRAY_BUFFER,n.buffer),t.enableVertexAttribArray(e),t.vertexAttribIPointer(e,n.numComponents||n.size,n.type||t.INT,n.stride||0,n.offset||0),void 0!==n.divisor&&t.vertexAttribDivisor(e,n.divisor)}}function S(t,e,n){var r=n.size,i=n.count;return function(n){t.bindBuffer(t.ARRAY_BUFFER,n.buffer);for(var s=n.size||n.numComponents||r,o=s/i,a=n.type||t.FLOAT,c=m[a].size*s,u=n.normalize||!1,l=n.offset||0,h=c/i,d=0;d<i;++d)t.enableVertexAttribArray(e+d),t.vertexAttribPointer(e+d,o,a,u,c,l+h*d),void 0!==n.divisor&&t.vertexAttribDivisor(e+d,n.divisor)}}m[5126]={Type:Float32Array,size:4,setter:function(t,e){return function(n){t.uniform1f(e,n)}},arraySetter:function(t,e){return function(n){t.uniform1fv(e,n)}}},m[35664]={Type:Float32Array,size:8,setter:function(t,e){return function(n){t.uniform2fv(e,n)}}},m[35665]={Type:Float32Array,size:12,setter:function(t,e){return function(n){t.uniform3fv(e,n)}}},m[35666]={Type:Float32Array,size:16,setter:function(t,e){return function(n){t.uniform4fv(e,n)}}},m[5124]={Type:Int32Array,size:4,setter:b,arraySetter:y},m[35667]={Type:Int32Array,size:8,setter:v},m[35668]={Type:Int32Array,size:12,setter:w},m[35669]={Type:Int32Array,size:16,setter:T},m[5125]={Type:Uint32Array,size:4,setter:function(t,e){return function(n){t.uniform1ui(e,n)}},arraySetter:function(t,e){return function(n){t.uniform1uiv(e,n)}}},m[36294]={Type:Uint32Array,size:8,setter:function(t,e){return function(n){t.uniform2uiv(e,n)}}},m[36295]={Type:Uint32Array,size:12,setter:function(t,e){return function(n){t.uniform3uiv(e,n)}}},m[36296]={Type:Uint32Array,size:16,setter:function(t,e){return function(n){t.uniform4uiv(e,n)}}},m[35670]={Type:Uint32Array,size:4,setter:b,arraySetter:y},m[35671]={Type:Uint32Array,size:8,setter:v},m[35672]={Type:Uint32Array,size:12,setter:w},m[35673]={Type:Uint32Array,size:16,setter:T},m[35674]={Type:Float32Array,size:16,setter:function(t,e){return function(n){t.uniformMatrix2fv(e,!1,n)}}},m[35675]={Type:Float32Array,size:36,setter:function(t,e){return function(n){t.uniformMatrix3fv(e,!1,n)}}},m[35676]={Type:Float32Array,size:64,setter:function(t,e){return function(n){t.uniformMatrix4fv(e,!1,n)}}},m[35685]={Type:Float32Array,size:24,setter:function(t,e){return function(n){t.uniformMatrix2x3fv(e,!1,n)}}},m[35686]={Type:Float32Array,size:32,setter:function(t,e){return function(n){t.uniformMatrix2x4fv(e,!1,n)}}},m[35687]={Type:Float32Array,size:24,setter:function(t,e){return function(n){t.uniformMatrix3x2fv(e,!1,n)}}},m[35688]={Type:Float32Array,size:48,setter:function(t,e){return function(n){t.uniformMatrix3x4fv(e,!1,n)}}},m[35689]={Type:Float32Array,size:32,setter:function(t,e){return function(n){t.uniformMatrix4x2fv(e,!1,n)}}},m[35690]={Type:Float32Array,size:48,setter:function(t,e){return function(n){t.uniformMatrix4x3fv(e,!1,n)}}},m[35678]={Type:null,size:0,setter:E,arraySetter:A,bindPoint:h},m[35680]={Type:null,size:0,setter:E,arraySetter:A,bindPoint:d},m[35679]={Type:null,size:0,setter:E,arraySetter:A,bindPoint:p},m[35682]={Type:null,size:0,setter:E,arraySetter:A,bindPoint:h},m[36289]={Type:null,size:0,setter:E,arraySetter:A,bindPoint:f},m[36292]={Type:null,size:0,setter:E,arraySetter:A,bindPoint:f},m[36293]={Type:null,size:0,setter:E,arraySetter:A,bindPoint:d},m[36298]={Type:null,size:0,setter:E,arraySetter:A,bindPoint:h},m[36299]={Type:null,size:0,setter:E,arraySetter:A,bindPoint:p},m[36300]={Type:null,size:0,setter:E,arraySetter:A,bindPoint:d},m[36303]={Type:null,size:0,setter:E,arraySetter:A,bindPoint:f},m[36306]={Type:null,size:0,setter:E,arraySetter:A,bindPoint:h},m[36307]={Type:null,size:0,setter:E,arraySetter:A,bindPoint:p},m[36308]={Type:null,size:0,setter:E,arraySetter:A,bindPoint:d},m[36311]={Type:null,size:0,setter:E,arraySetter:A,bindPoint:f};var x={};x[5126]={size:4,setter:k},x[35664]={size:8,setter:k},x[35665]={size:12,setter:k},x[35666]={size:16,setter:k},x[5124]={size:4,setter:I},x[35667]={size:8,setter:I},x[35668]={size:12,setter:I},x[35669]={size:16,setter:I},x[5125]={size:4,setter:I},x[36294]={size:8,setter:I},x[36295]={size:12,setter:I},x[36296]={size:16,setter:I},x[35670]={size:4,setter:I},x[35671]={size:8,setter:I},x[35672]={size:12,setter:I},x[35673]={size:16,setter:I},x[35674]={size:4,setter:S,count:2},x[35675]={size:9,setter:S,count:3},x[35676]={size:16,setter:S,count:4};var O=void 0,M=/^[ \t]*\n/;function N(t,e,n,r){var i=r||c,s=t.createShader(n),o=0;if(M.test(e)&&(o=1,e=e.replace(M,"")),t.shaderSource(s,e),t.compileShader(s),!t.getShaderParameter(s,t.COMPILE_STATUS)){var a=t.getShaderInfoLog(s);return i(function(t,e){return e=e||0,++e,t.split("\n").map((function(t,n){return n+e+": "+t})).join("\n")}(e,o)+"\n*** Error compiling shader: "+a),t.deleteShader(s),null}return s}function C(t,e,n){var r;if("function"==typeof e&&(n=e,e=void 0),"function"==typeof t)n=t,t=void 0;else if(t&&!Array.isArray(t)){if(t.errorCallback)return t;var i=t;n=i.errorCallback,t=i.attribLocations,r=i.transformFeedbackVaryings}var s={errorCallback:n||c,transformFeedbackVaryings:r};if(t){var o={};Array.isArray(t)?t.forEach((function(t,n){o[t]=e?e[n]:n})):o=t,s.attribLocations=o}return s}var R=["VERTEX_SHADER","FRAGMENT_SHADER"];function D(t){return t.indexOf("frag")>=0?O.FRAGMENT_SHADER:t.indexOf("vert")>=0?O.VERTEX_SHADER:void 0}function P(t,e){e.forEach((function(e){t.deleteShader(e)}))}function L(t,e,n,r,i){for(var o=C(n,r,i),a=[],c=[],u=0;u<e.length;++u){var h=e[u];if("string"==typeof h){var d=l(h),p=d?d.text:h,f=t[R[u]];d&&d.type&&(f=D(d.type)||f),h=N(t,p,f,o.errorCallback),c.push(h)}s.isShader(t,h)&&a.push(h)}if(a.length!==e.length)return o.errorCallback("not enough shaders for program"),P(t,c),null;var m=t.createProgram();a.forEach((function(e){t.attachShader(m,e)})),o.attribLocations&&Object.keys(o.attribLocations).forEach((function(e){t.bindAttribLocation(m,o.attribLocations[e],e)}));var g=o.transformFeedbackVaryings;if(g&&(g.attribs&&(g=g.attribs),Array.isArray(g)||(g=Object.keys(g)),t.transformFeedbackVaryings(m,g,o.transformFeedbackMode||t.SEPARATE_ATTRIBS)),t.linkProgram(m),!t.getProgramParameter(m,t.LINK_STATUS)){var b=t.getProgramInfoLog(m);return o.errorCallback("Error in program linking:"+b),t.deleteProgram(m),P(t,c),null}return m}function B(t,e,n,r){var i,s=l(e);if(!s)throw"*** Error: unknown script element"+e;i=s.text;var o=n||D(s.type);if(!o)throw"*** Error: unknown shader type";return N(t,i,o,r)}function U(t,e,n,r,i){for(var s=C(n,r,i),o=[],a=0;a<e.length;++a){var c=N(t,e[a],t[R[a]],s.errorCallback);if(!c)return null;o.push(c)}return L(t,o,s)}function j(t){var e=t.name;return e.startsWith("gl_")||e.startsWith("webgl_")}function F(t,e){var n=0;function r(e,r){var i,s=t.getUniformLocation(e,r.name),o=r.size>1&&"[0]"===r.name.substr(-3),a=r.type,c=m[a];if(!c)throw"unknown type: 0x"+a.toString(16);if(c.bindPoint){var u=n;n+=r.size,i=o?c.arraySetter(t,a,u,s,r.size):c.setter(t,a,u,s,r.size)}else i=c.arraySetter&&o?c.arraySetter(t,s):c.setter(t,s);return i.location=s,i}for(var i={},s=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),o=0;o<s;++o){var a=t.getActiveUniform(e,o);if(!j(a)){var c=a.name;"[0]"===c.substr(-3)&&(c=c.substr(0,c.length-3));var u=r(e,a);i[c]=u}}return i}function z(t,e){for(var n={},r=t.getProgramParameter(e,t.TRANSFORM_FEEDBACK_VARYINGS),i=0;i<r;++i){var s=t.getTransformFeedbackVarying(e,i);n[s.name]={index:i,type:s.type,size:s.size}}return n}function V(t,e,n){for(var r in e.transformFeedbackInfo&&(e=e.transformFeedbackInfo),n.attribs&&(n=n.attribs),n){var i=e[r];if(i){var s=n[r];s.offset?t.bindBufferRange(t.TRANSFORM_FEEDBACK_BUFFER,i.index,s.buffer,s.offset,s.size):t.bindBufferBase(t.TRANSFORM_FEEDBACK_BUFFER,i.index,s.buffer)}}}function G(t,e){for(var n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r=[],i=[],s=0;s<n;++s){i.push(s),r.push({});var o=t.getActiveUniform(e,s);if(j(o))break;r[s].name=o.name}[["UNIFORM_TYPE","type"],["UNIFORM_SIZE","size"],["UNIFORM_BLOCK_INDEX","blockNdx"],["UNIFORM_OFFSET","offset"]].forEach((function(n){var s=n[0],o=n[1];t.getActiveUniforms(e,i,t[s]).forEach((function(t,e){r[e][o]=t}))}));for(var a={},c=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS),u=0;u<c;++u){var l=t.getActiveUniformBlockName(e,u),h={index:u,usedByVertexShader:t.getActiveUniformBlockParameter(e,u,t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:t.getActiveUniformBlockParameter(e,u,t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:t.getActiveUniformBlockParameter(e,u,t.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:t.getActiveUniformBlockParameter(e,u,t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES)};h.used=h.usedByVertexSahder||h.usedByFragmentShader,a[l]=h}return{blockSpecs:a,uniformData:r}}var Y=/\[\d+\]\.$/;function H(t,e,n,r){var i=n.blockSpecs,s=n.uniformData,o=i[r];if(!o)return u("no uniform block object named:",r),{name:r,uniforms:{}};var a=new ArrayBuffer(o.size),c=t.createBuffer(),l=o.index;t.bindBuffer(t.UNIFORM_BUFFER,c),t.uniformBlockBinding(e,o.index,l);var h=r+".";Y.test(h)&&(h=h.replace(Y,"."));var d={};return o.uniformIndices.forEach((function(t){var e=s[t],n=m[e.type],r=n.Type,i=e.size*n.size,o=e.name;o.substr(0,h.length)===h&&(o=o.substr(h.length)),d[o]=new r(a,e.offset,i/r.BYTES_PER_ELEMENT)})),{name:r,array:a,asFloat:new Float32Array(a),buffer:c,uniforms:d}}function W(t,e,n){var r=(e.uniformBlockSpec||e).blockSpecs[n.name];if(r){var i=r.index;return t.bindBufferRange(t.UNIFORM_BUFFER,i,n.buffer,n.offset||0,n.array.byteLength),!0}return!1}function K(t,e){for(var n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),i=0;i<r;++i){var s=t.getActiveAttrib(e,i);if(!j(s)){var o=t.getAttribLocation(e,s.name),a=x[s.type],c=a.setter(t,o,a);c.location=o,n[s.name]=c}}return n}function q(t,e){for(var n in e){var r=t[n];r&&r(e[n])}}function Q(t,e){var n={program:e,uniformSetters:F(t,e),attribSetters:K(t,e)};return i.isWebGL2(t)&&(n.uniformBlockSpec=G(t,e),n.transformFeedbackInfo=z(t,e)),n}},function(t,e,n){"use strict";e.__esModule=!0,e.axisRotate=function(t,e,n,r){r=r||new i(16);var s=e[0],o=e[1],a=e[2],c=Math.sqrt(s*s+o*o+a*a),u=(s/=c)*s,l=(o/=c)*o,h=(a/=c)*a,d=Math.cos(n),p=Math.sin(n),f=1-d,m=u+(1-u)*d,g=s*o*f+a*p,b=s*a*f-o*p,y=s*o*f-a*p,v=l+(1-l)*d,w=o*a*f+s*p,T=s*a*f+o*p,E=o*a*f-s*p,A=h+(1-h)*d,k=t[0],I=t[1],S=t[2],x=t[3],O=t[4],M=t[5],N=t[6],C=t[7],R=t[8],D=t[9],P=t[10],L=t[11];return r[0]=m*k+g*O+b*R,r[1]=m*I+g*M+b*D,r[2]=m*S+g*N+b*P,r[3]=m*x+g*C+b*L,r[4]=y*k+v*O+w*R,r[5]=y*I+v*M+w*D,r[6]=y*S+v*N+w*P,r[7]=y*x+v*C+w*L,r[8]=T*k+E*O+A*R,r[9]=T*I+E*M+A*D,r[10]=T*S+E*N+A*P,r[11]=T*x+E*C+A*L,t!==r&&(r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r},e.axisRotation=function(t,e,n){n=n||new i(16);var r=t[0],s=t[1],o=t[2],a=Math.sqrt(r*r+s*s+o*o),c=(r/=a)*r,u=(s/=a)*s,l=(o/=a)*o,h=Math.cos(e),d=Math.sin(e),p=1-h;return n[0]=c+(1-c)*h,n[1]=r*s*p+o*d,n[2]=r*o*p-s*d,n[3]=0,n[4]=r*s*p-o*d,n[5]=u+(1-u)*h,n[6]=s*o*p+r*d,n[7]=0,n[8]=r*o*p+s*d,n[9]=s*o*p-r*d,n[10]=l+(1-l)*h,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n},e.copy=c,e.frustum=function(t,e,n,r,s,o,a){a=a||new i(16);var c=e-t,u=r-n,l=s-o;return a[0]=2*s/c,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2*s/u,a[6]=0,a[7]=0,a[8]=(t+e)/c,a[9]=(r+n)/u,a[10]=o/l,a[11]=-1,a[12]=0,a[13]=0,a[14]=s*o/l,a[15]=0,a},e.getAxis=function(t,e,n){n=n||r.create();var i=4*e;return n[0]=t[i+0],n[1]=t[i+1],n[2]=t[i+2],n},e.getTranslation=function(t,e){return(e=e||r.create())[0]=t[12],e[1]=t[13],e[2]=t[14],e},e.identity=u,e.inverse=l,e.lookAt=function(t,e,n,c){c=c||new i(16);var u=s,l=o,h=a;return r.normalize(r.subtract(t,e,h),h),r.normalize(r.cross(n,h,u),u),r.normalize(r.cross(h,u,l),l),c[0]=u[0],c[1]=u[1],c[2]=u[2],c[3]=0,c[4]=l[0],c[5]=l[1],c[6]=l[2],c[7]=0,c[8]=h[0],c[9]=h[1],c[10]=h[2],c[11]=0,c[12]=t[0],c[13]=t[1],c[14]=t[2],c[15]=1,c},e.multiply=function(t,e,n){n=n||new i(16);var r=t[0],s=t[1],o=t[2],a=t[3],c=t[4],u=t[5],l=t[6],h=t[7],d=t[8],p=t[9],f=t[10],m=t[11],g=t[12],b=t[13],y=t[14],v=t[15],w=e[0],T=e[1],E=e[2],A=e[3],k=e[4],I=e[5],S=e[6],x=e[7],O=e[8],M=e[9],N=e[10],C=e[11],R=e[12],D=e[13],P=e[14],L=e[15];return n[0]=r*w+c*T+d*E+g*A,n[1]=s*w+u*T+p*E+b*A,n[2]=o*w+l*T+f*E+y*A,n[3]=a*w+h*T+m*E+v*A,n[4]=r*k+c*I+d*S+g*x,n[5]=s*k+u*I+p*S+b*x,n[6]=o*k+l*I+f*S+y*x,n[7]=a*k+h*I+m*S+v*x,n[8]=r*O+c*M+d*N+g*C,n[9]=s*O+u*M+p*N+b*C,n[10]=o*O+l*M+f*N+y*C,n[11]=a*O+h*M+m*N+v*C,n[12]=r*R+c*D+d*P+g*L,n[13]=s*R+u*D+p*P+b*L,n[14]=o*R+l*D+f*P+y*L,n[15]=a*R+h*D+m*P+v*L,n},e.negate=function(t,e){return(e=e||new i(16))[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=-t[7],e[8]=-t[8],e[9]=-t[9],e[10]=-t[10],e[11]=-t[11],e[12]=-t[12],e[13]=-t[13],e[14]=-t[14],e[15]=-t[15],e},e.ortho=function(t,e,n,r,s,o,a){return(a=a||new i(16))[0]=2/(e-t),a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2/(r-n),a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=2/(s-o),a[11]=0,a[12]=(e+t)/(t-e),a[13]=(r+n)/(n-r),a[14]=(o+s)/(s-o),a[15]=1,a},e.perspective=function(t,e,n,r,s){s=s||new i(16);var o=Math.tan(.5*Math.PI-.5*t),a=1/(n-r);return s[0]=o/e,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=o,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=(n+r)*a,s[11]=-1,s[12]=0,s[13]=0,s[14]=n*r*a*2,s[15]=0,s},e.rotateX=function(t,e,n){n=n||new i(16);var r=t[4],s=t[5],o=t[6],a=t[7],c=t[8],u=t[9],l=t[10],h=t[11],d=Math.cos(e),p=Math.sin(e);return n[4]=d*r+p*c,n[5]=d*s+p*u,n[6]=d*o+p*l,n[7]=d*a+p*h,n[8]=d*c-p*r,n[9]=d*u-p*s,n[10]=d*l-p*o,n[11]=d*h-p*a,t!==n&&(n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n},e.rotateY=function(t,e,n){n=n||new i(16);var r=t[0],s=t[1],o=t[2],a=t[3],c=t[8],u=t[9],l=t[10],h=t[11],d=Math.cos(e),p=Math.sin(e);return n[0]=d*r-p*c,n[1]=d*s-p*u,n[2]=d*o-p*l,n[3]=d*a-p*h,n[8]=d*c+p*r,n[9]=d*u+p*s,n[10]=d*l+p*o,n[11]=d*h+p*a,t!==n&&(n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n},e.rotateZ=function(t,e,n){n=n||new i(16);var r=t[0],s=t[1],o=t[2],a=t[3],c=t[4],u=t[5],l=t[6],h=t[7],d=Math.cos(e),p=Math.sin(e);return n[0]=d*r+p*c,n[1]=d*s+p*u,n[2]=d*o+p*l,n[3]=d*a+p*h,n[4]=d*c-p*r,n[5]=d*u-p*s,n[6]=d*l-p*o,n[7]=d*h-p*a,t!==n&&(n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n},e.rotationX=function(t,e){e=e||new i(16);var n=Math.cos(t),r=Math.sin(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.rotationY=function(t,e){e=e||new i(16);var n=Math.cos(t),r=Math.sin(t);return e[0]=n,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.rotationZ=function(t,e){e=e||new i(16);var n=Math.cos(t),r=Math.sin(t);return e[0]=n,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.scale=function(t,e,n){n=n||new i(16);var r=e[0],s=e[1],o=e[2];return n[0]=r*t[0],n[1]=r*t[1],n[2]=r*t[2],n[3]=r*t[3],n[4]=s*t[4],n[5]=s*t[5],n[6]=s*t[6],n[7]=s*t[7],n[8]=o*t[8],n[9]=o*t[9],n[10]=o*t[10],n[11]=o*t[11],t!==n&&(n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n},e.scaling=function(t,e){return(e=e||new i(16))[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.setAxis=function(t,e,n,r){r!==t&&(r=c(t,r));var i=4*n;return r[i+0]=e[0],r[i+1]=e[1],r[i+2]=e[2],r},e.setDefaultType=function(t){var e=i;return i=t,e},e.setTranslation=function(t,e,n){return n=n||u(),t!==n&&(n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11]),n[12]=e[0],n[13]=e[1],n[14]=e[2],n[15]=1,n},e.transformDirection=function(t,e,n){n=n||r.create();var i=e[0],s=e[1],o=e[2];return n[0]=i*t[0]+s*t[4]+o*t[8],n[1]=i*t[1]+s*t[5]+o*t[9],n[2]=i*t[2]+s*t[6]+o*t[10],n},e.transformNormal=function(t,e,n){n=n||r.create();var i=l(t),s=e[0],o=e[1],a=e[2];return n[0]=s*i[0]+o*i[1]+a*i[2],n[1]=s*i[4]+o*i[5]+a*i[6],n[2]=s*i[8]+o*i[9]+a*i[10],n},e.transformPoint=function(t,e,n){n=n||r.create();var i=e[0],s=e[1],o=e[2],a=i*t[3]+s*t[7]+o*t[11]+t[15];return n[0]=(i*t[0]+s*t[4]+o*t[8]+t[12])/a,n[1]=(i*t[1]+s*t[5]+o*t[9]+t[13])/a,n[2]=(i*t[2]+s*t[6]+o*t[10]+t[14])/a,n},e.translate=function(t,e,n){n=n||new i(16);var r=e[0],s=e[1],o=e[2],a=t[0],c=t[1],u=t[2],l=t[3],h=t[4],d=t[5],p=t[6],f=t[7],m=t[8],g=t[9],b=t[10],y=t[11],v=t[12],w=t[13],T=t[14],E=t[15];return t!==n&&(n[0]=a,n[1]=c,n[2]=u,n[3]=l,n[4]=h,n[5]=d,n[6]=p,n[7]=f,n[8]=m,n[9]=g,n[10]=b,n[11]=y),n[12]=a*r+h*s+m*o+v,n[13]=c*r+d*s+g*o+w,n[14]=u*r+p*s+b*o+T,n[15]=l*r+f*s+y*o+E,n},e.translation=function(t,e){return(e=e||new i(16))[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e},e.transpose=function(t,e){var n;if((e=e||new i(16))===t)return n=t[1],t[1]=t[4],t[4]=n,n=t[2],t[2]=t[8],t[8]=n,n=t[3],t[3]=t[12],t[12]=n,n=t[6],t[6]=t[9],t[9]=n,n=t[7],t[7]=t[13],t[13]=n,n=t[11],t[11]=t[14],t[14]=n,e;var r=t[0],s=t[1],o=t[2],a=t[3],c=t[4],u=t[5],l=t[6],h=t[7],d=t[8],p=t[9],f=t[10],m=t[11],g=t[12],b=t[13],y=t[14],v=t[15];return e[0]=r,e[1]=c,e[2]=d,e[3]=g,e[4]=s,e[5]=u,e[6]=p,e[7]=b,e[8]=o,e[9]=l,e[10]=f,e[11]=y,e[12]=a,e[13]=h,e[14]=m,e[15]=v,e};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}(n(3)),i=Float32Array,s=r.create(),o=r.create(),a=r.create();function c(t,e){return(e=e||new i(16))[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function u(t){return(t=t||new i(16))[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function l(t,e){e=e||new i(16);var n=t[0],r=t[1],s=t[2],o=t[3],a=t[4],c=t[5],u=t[6],l=t[7],h=t[8],d=t[9],p=t[10],f=t[11],m=t[12],g=t[13],b=t[14],y=t[15],v=p*y,w=b*f,T=u*y,E=b*l,A=u*f,k=p*l,I=s*y,S=b*o,x=s*f,O=p*o,M=s*l,N=u*o,C=h*g,R=m*d,D=a*g,P=m*c,L=a*d,B=h*c,U=n*g,j=m*r,F=n*d,z=h*r,V=n*c,G=a*r,Y=v*c+E*d+A*g-(w*c+T*d+k*g),H=w*r+I*d+O*g-(v*r+S*d+x*g),W=T*r+S*c+M*g-(E*r+I*c+N*g),K=k*r+x*c+N*d-(A*r+O*c+M*d),q=1/(n*Y+a*H+h*W+m*K);return e[0]=q*Y,e[1]=q*H,e[2]=q*W,e[3]=q*K,e[4]=q*(w*a+T*h+k*m-(v*a+E*h+A*m)),e[5]=q*(v*n+S*h+x*m-(w*n+I*h+O*m)),e[6]=q*(E*n+I*a+N*m-(T*n+S*a+M*m)),e[7]=q*(A*n+O*a+M*h-(k*n+x*a+N*h)),e[8]=q*(C*l+P*f+L*y-(R*l+D*f+B*y)),e[9]=q*(R*o+U*f+z*y-(C*o+j*f+F*y)),e[10]=q*(D*o+j*l+V*y-(P*o+U*l+G*y)),e[11]=q*(B*o+F*l+G*f-(L*o+z*l+V*f)),e[12]=q*(D*p+B*b+R*u-(L*b+C*u+P*p)),e[13]=q*(F*b+C*s+j*p-(U*p+z*b+R*s)),e[14]=q*(U*u+G*b+P*s-(V*b+D*s+j*u)),e[15]=q*(V*p+L*s+z*u-(F*u+G*p+B*s)),e}},function(t,e,n){"use strict";e.__esModule=!0,e.createAttribsFromArrays=g,e.createBuffersFromArrays=function(t,e){var n={};return Object.keys(e).forEach((function(r){n[r]=y(t,e[r],r)})),e.indices?(n.numElements=e.indices.length,n.elementType=r.getGLTypeForTypedArray(m(e.indices),"indices")):n.numElements=function(t){for(var e,n=0;n<b.length&&!((e=b[n])in t);++n);ii===b.length&&(e=Object.keys(t)[0]);var r=t[e],i=l(r).length,s=f(r,e),o=i/s;if(i%s>0)throw"numComponents "+s+" not correct for length "+i;return o}(e),n},e.createBufferFromArray=y,e.createBufferFromTypedArray=c,e.createBufferInfoFromArrays=function(t,e){var n={attribs:g(t,e)},i=e.indices;if(i){var s=m(i,"indices");n.indices=c(t,s,t.ELEMENT_ARRAY_BUFFER),n.numElements=s.length,n.elementType=r.getGLTypeForTypedArray(s)}else n.numElements=function(t,e){var n,r;for(r=0;r<b.length&&!((n=b[r])in e)&&!((n=o.attribPrefix+n)in e);++r);r===b.length&&(n=Object.keys(e)[0]);var i=e[n];t.bindBuffer(t.ARRAY_BUFFER,i.buffer);var s=t.getBufferParameter(t.ARRAY_BUFFER,t.BUFFER_SIZE);t.bindBuffer(t.ARRAY_BUFFER,null);var a=function(t,e){return e===t.BYTE||e===t.UNSIGNED_BYTE?1:e===t.SHORT||e===t.UNSIGNED_SHORT?2:e===t.INT||e===t.UNSIGNED_INT||e===t.FLOAT?4:0}(t,i.type),c=s/a,u=i.numComponents||i.size,l=c/u;if(l%1!=0)throw"numComponents "+u+" not correct for length "+length;return l}(t,n.attribs);return n},e.setAttribInfoBufferFromArray=function(t,e,n,r){n=m(n),void 0!==r?(t.bindBuffer(t.ARRAY_BUFFER,e.buffer),t.bufferSubData(t.ARRAY_BUFFER,r,n)):a(t,t.ARRAY_BUFFER,e.buffer,n,e.drawType)},e.setAttributePrefix=function(t){o.attribPrefix=t},e.setAttributeDefaults_=function(t){i.copyExistingProperties(t,o)},e.getNumComponents_=f,e.getArray_=l;var r=s(n(1)),i=s(n(0));function s(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}var o={attribPrefix:""};function a(t,e,n,r,i){t.bindBuffer(e,n),t.bufferData(e,r,i||t.STATIC_DRAW)}function c(t,e,n,r){if(i.isBuffer(t,e))return e;n=n||t.ARRAY_BUFFER;var s=t.createBuffer();return a(t,n,s,e,r),s}function u(t){return"indices"===t}function l(t){return t.length?t:t.data}var h=/coord|texture/i,d=/color|colour/i;function p(t,e){var n;if(e%(n=h.test(t)?2:d.test(t)?4:3)>0)throw"Can not guess numComponents for attribute '"+t+"'. Tried "+n+" but "+e+" values is not evenly divisible by "+n+". You should specify it.";return n}function f(t,e){return t.numComponents||t.size||p(e,l(t).length)}function m(t,e){if(r.isArrayBuffer(t))return t;if(r.isArrayBuffer(t.data))return t.data;Array.isArray(t)&&(t={data:t});var n=t.type;return n||(n=u(e)?Uint16Array:Float32Array),new n(t.data)}function g(t,e){var n={};return Object.keys(e).forEach((function(i){if(!u(i)){var s,a,l,h,d,g=e[i],b=g.attrib||g.name||g.attribName||o.attribPrefix+i;if("number"==typeof g||"number"==typeof g.data){d=g.data||g;var y=g.type||Float32Array,v=d*y.BYTES_PER_ELEMENT;a=r.getGLTypeForTypedArrayType(y),l=void 0!==g.normalize?g.normalize:(T=y)===Int8Array||T===Uint8Array,h=g.numComponents||g.size||p(i,d),s=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,s),t.bufferData(t.ARRAY_BUFFER,v,g.drawType||t.STATIC_DRAW)}else{var w=m(g,i);s=c(t,w,void 0,g.drawType),a=r.getGLTypeForTypedArray(w),l=void 0!==g.normalize?g.normalize:function(t){return t instanceof Int8Array||t instanceof Uint8Array}(w),h=f(g,i),d=w.length}n[b]={buffer:s,numComponents:h,type:a,normalize:l,stride:g.stride||0,offset:g.offset||0,divisor:void 0===g.divisor?void 0:g.divisor,drawType:g.drawType}}var T})),t.bindBuffer(t.ARRAY_BUFFER,null),n}var b=["position","positions","a_position"];function y(t,e,n){var r="indices"===n?t.ELEMENT_ARRAY_BUFFER:t.ARRAY_BUFFER;return c(t,m(e,n),r)}},function(t,e,n){"use strict";e.__esModule=!0,e.setTextureDefaults_=function(t){o.copyExistingProperties(t,u),t.textureColor&&H(t.textureColor)},e.createSampler=$,e.createSamplers=function(t,e){var n={};return Object.keys(e).forEach((function(r){n[r]=$(t,e[r])})),n},e.setSamplerParameters=_,e.createTexture=ft,e.setEmptyTexture=pt,e.setTextureFromArray=dt,e.loadTextureFromUrl=ut,e.setTextureFromElement=it,e.setTextureFilteringForSize=tt,e.setTextureParameters=J,e.setDefaultTextureColor=H,e.createTextures=function(t,e,n){n=n||st;var r=0,i=[],s={},o={};function a(){0===r&&setTimeout((function(){n(i.length?i:void 0,s,o)}),0)}return Object.keys(e).forEach((function(n){var c,u,l=e[n];("string"==typeof(u=l.src)||Array.isArray(u)&&"string"==typeof u[0])&&(c=function(t,e,s){o[n]=s,--r,t&&i.push(t),a()},++r),s[n]=ft(t,l,c)})),a(),s},e.resizeTexture=function(t,e,n,r,i){r=r||n.width,i=i||n.height;var s=n.target||t.TEXTURE_2D;t.bindTexture(s,e);var o,a=n.level||0,c=n.internalFormat||n.format||t.RGBA,u=z(c),h=n.format||u.format,d=n.src;if(o=d&&(l(d)||Array.isArray(d)&&"number"==typeof d[0])?n.type||G(t,d,u.type):n.type||u.type,s===t.TEXTURE_CUBE_MAP)for(var p=0;p<6;++p)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,a,c,r,i,0,h,o,null);else t.texImage2D(s,a,c,r,i,0,h,o,null)},e.getNumComponentsForFormat=function(t){var e=L[t];if(!e)throw"unknown format: "+t;return e.numColorComponents},e.getBytesPerElementForInternalFormat=F;var r,i=c(n(4)),s=c(n(1)),o=c(n(0)),a=(r=n(2))&&r.__esModule?r:{default:r};function c(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}var u={textureColor:new Uint8Array([128,192,255,255]),textureOptions:{},crossOrigin:void 0},l=s.isArrayBuffer,h=a.default.document&&a.default.document.createElement?a.default.document.createElement("canvas").getContext("2d"):null,d=6406,p=6407,f=6408,m=6409,g=6410,b=6402,y=34041,v=5120,w=5121,T=5122,E=5123,A=5124,k=5125,I=5126,S=5131,x=36193,O=33640,M=33319,N=33320,C=6403,R=36244,D=36248,P=36249,L={},B=L;B[6406]={numColorComponents:1},B[6409]={numColorComponents:1},B[6410]={numColorComponents:2},B[p]={numColorComponents:3},B[f]={numColorComponents:4},B[C]={numColorComponents:1},B[36244]={numColorComponents:1},B[M]={numColorComponents:2},B[33320]={numColorComponents:2},B[p]={numColorComponents:3},B[36248]={numColorComponents:3},B[f]={numColorComponents:4},B[36249]={numColorComponents:4},B[6402]={numColorComponents:1},B[34041]={numColorComponents:2};var U={},j=U;function F(t,e){var n=U[t];if(!n)throw"unknown internal format";var r=n.bytesPerElementMap[e];if(void 0===r)throw"unknown internal format";return r}function z(t){var e=U[t];if(!e)throw"unknown internal format";return{format:e.textureFormat,type:Array.isArray(e.type)?e.type[0]:e.type}}function V(t){return!(t&t-1)}function G(t,e,n){return l(e)?s.getGLTypeForTypedArray(e):n||t.UNSIGNED_BYTE}function Y(t,e,n,r,i){if(i%1!=0)throw"can't guess dimensions";if(n||r){if(r){if(!n&&(n=i/r)%1)throw"can't guess dimensions"}else if((r=i/n)%1)throw"can't guess dimensions"}else{var s=Math.sqrt(i/(e===t.TEXTURE_CUBE_MAP?6:1));s%1==0?(n=s,r=s):(n=i,r=1)}return{width:n,height:r}}function H(t){u.textureColor=new Uint8Array([255*t[0],255*t[1],255*t[2],255*t[3]])}j[6406]={textureFormat:d,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[w,S,x,I]},j[6409]={textureFormat:m,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[w,S,x,I]},j[6410]={textureFormat:g,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[2,4,4,8],type:[w,S,x,I]},j[p]={textureFormat:p,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,6,6,12,2],type:[w,S,x,I,33635]},j[f]={textureFormat:f,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,8,8,16,2,2],type:[w,S,x,I,32819,32820]},j[33321]={textureFormat:C,colorRenderable:!0,textureFilterable:!0,bytesPerElement:1,type:w},j[36756]={textureFormat:C,colorRenderable:!1,textureFilterable:!0,bytesPerElement:1,type:v},j[33325]={textureFormat:C,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[4,2],type:[I,S]},j[33326]={textureFormat:C,colorRenderable:!1,textureFilterable:!1,bytesPerElement:4,type:I},j[33330]={textureFormat:R,colorRenderable:!0,textureFilterable:!1,bytesPerElement:1,type:w},j[33329]={textureFormat:R,colorRenderable:!0,textureFilterable:!1,bytesPerElement:1,type:v},j[33332]={textureFormat:R,colorRenderable:!0,textureFilterable:!1,bytesPerElement:2,type:E},j[33331]={textureFormat:R,colorRenderable:!0,textureFilterable:!1,bytesPerElement:2,type:T},j[33334]={textureFormat:R,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:k},j[33333]={textureFormat:R,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:A},j[33323]={textureFormat:M,colorRenderable:!0,textureFilterable:!0,bytesPerElement:2,type:w},j[36757]={textureFormat:M,colorRenderable:!1,textureFilterable:!0,bytesPerElement:2,type:v},j[33327]={textureFormat:M,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[8,4],type:[I,S]},j[33328]={textureFormat:M,colorRenderable:!1,textureFilterable:!1,bytesPerElement:8,type:I},j[33336]={textureFormat:N,colorRenderable:!0,textureFilterable:!1,bytesPerElement:2,type:w},j[33335]={textureFormat:N,colorRenderable:!0,textureFilterable:!1,bytesPerElement:2,type:v},j[33338]={textureFormat:N,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:E},j[33337]={textureFormat:N,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:T},j[33340]={textureFormat:N,colorRenderable:!0,textureFilterable:!1,bytesPerElement:8,type:k},j[33339]={textureFormat:N,colorRenderable:!0,textureFilterable:!1,bytesPerElement:8,type:A},j[32849]={textureFormat:p,colorRenderable:!0,textureFilterable:!0,bytesPerElement:3,type:w},j[35905]={textureFormat:p,colorRenderable:!1,textureFilterable:!0,bytesPerElement:3,type:w},j[36194]={textureFormat:p,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,2],type:[w,33635]},j[36758]={textureFormat:p,colorRenderable:!1,textureFilterable:!0,bytesPerElement:3,type:v},j[35898]={textureFormat:p,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[I,S,35899]},j[35901]={textureFormat:p,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[I,S,35902]},j[34843]={textureFormat:p,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6],type:[I,S]},j[34837]={textureFormat:p,colorRenderable:!1,textureFilterable:!1,bytesPerElement:12,type:I},j[36221]={textureFormat:D,colorRenderable:!1,textureFilterable:!1,bytesPerElement:3,type:w},j[36239]={textureFormat:D,colorRenderable:!1,textureFilterable:!1,bytesPerElement:3,type:v},j[36215]={textureFormat:D,colorRenderable:!1,textureFilterable:!1,bytesPerElement:6,type:E},j[36233]={textureFormat:D,colorRenderable:!1,textureFilterable:!1,bytesPerElement:6,type:T},j[36209]={textureFormat:D,colorRenderable:!1,textureFilterable:!1,bytesPerElement:12,type:k},j[36227]={textureFormat:D,colorRenderable:!1,textureFilterable:!1,bytesPerElement:12,type:A},j[32856]={textureFormat:f,colorRenderable:!0,textureFilterable:!0,bytesPerElement:4,type:w},j[35907]={textureFormat:f,colorRenderable:!0,textureFilterable:!0,bytesPerElement:4,type:w},j[36759]={textureFormat:f,colorRenderable:!1,textureFilterable:!0,bytesPerElement:4,type:v},j[32855]={textureFormat:f,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2,4],type:[w,32820,O]},j[32854]={textureFormat:f,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2],type:[w,32819]},j[32857]={textureFormat:f,colorRenderable:!0,textureFilterable:!0,bytesPerElement:4,type:O},j[34842]={textureFormat:f,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[16,8],type:[I,S]},j[34836]={textureFormat:f,colorRenderable:!1,textureFilterable:!1,bytesPerElement:16,type:I},j[36220]={textureFormat:P,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:w},j[36238]={textureFormat:P,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:v},j[36975]={textureFormat:P,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:O},j[36214]={textureFormat:P,colorRenderable:!0,textureFilterable:!1,bytesPerElement:8,type:E},j[36232]={textureFormat:P,colorRenderable:!0,textureFilterable:!1,bytesPerElement:8,type:T},j[36226]={textureFormat:P,colorRenderable:!0,textureFilterable:!1,bytesPerElement:16,type:A},j[36208]={textureFormat:P,colorRenderable:!0,textureFilterable:!1,bytesPerElement:16,type:k},j[33189]={textureFormat:b,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2,4],type:[E,k]},j[33190]={textureFormat:b,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:k},j[36012]={textureFormat:b,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:I},j[35056]={textureFormat:y,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:34042},j[36013]={textureFormat:y,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:36269},Object.keys(j).forEach((function(t){var e=j[t];if(e.bytesPerElementMap={},Array.isArray(e.bytesPerElement))e.bytesPerElement.forEach((function(t,n){var r=e.type[n];e.bytesPerElementMap[r]=t}));else{var n=e.type;e.bytesPerElementMap[n]=e.bytesPerElement}}));var W={};function K(t,e){void 0!==e.colorspaceConversion&&(W.colorspaceConversion=t.getParameter(t.UNPACK_COLORSPACE_CONVERSION_WEBGL),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.colorspaceConversion)),void 0!==e.premultiplyAlpha&&(W.premultiplyAlpha=t.getParameter(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha)),void 0!==e.flipY&&(W.flipY=t.getParameter(t.UNPACK_FLIP_Y_WEBGL),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY))}function q(t,e){void 0!==e.colorspaceConversion&&t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,W.colorspaceConversion),void 0!==e.premultiplyAlpha&&t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),void 0!==e.flipY&&t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,W.flipY)}function Q(t){W.unpackAlignment=t.getParameter(t.UNPACK_ALIGNMENT),i.isWebGL2(t)&&(W.unpackRowLength=t.getParameter(t.UNPACK_ROW_LENGTH),W.unpackImageHeight=t.getParameter(t.UNPACK_IMAGE_HEIGHT),W.unpackSkipPixels=t.getParameter(t.UNPACK_SKIP_PIXELS),W.unpackSkipRows=t.getParameter(t.UNPACK_SKIP_ROWS),W.unpackSkipImages=t.getParameter(t.UNPACK_SKIP_IMAGES))}function X(t){t.pixelStorei(t.UNPACK_ALIGNMENT,W.unpackAlignment),i.isWebGL2(t)&&(t.pixelStorei(t.UNPACK_ROW_LENGTH,W.unpackRowLength),t.pixelStorei(t.UNPACK_IMAGE_HEIGHT,W.unpackImageHeight),t.pixelStorei(t.UNPACK_SKIP_PIXELS,W.unpackSkipPixels),t.pixelStorei(t.UNPACK_SKIP_ROWS,W.unpackSkipRows),t.pixelStorei(t.UNPACK_SKIP_IMAGES,W.unpackSkipImages))}function Z(t,e,n,r){r.minMag&&(n.call(t,e,t.TEXTURE_MIN_FILTER,r.minMag),n.call(t,e,t.TEXTURE_MAG_FILTER,r.minMag)),r.min&&n.call(t,e,t.TEXTURE_MIN_FILTER,r.min),r.mag&&n.call(t,e,t.TEXTURE_MAG_FILTER,r.mag),r.wrap&&(n.call(t,e,t.TEXTURE_WRAP_S,r.wrap),n.call(t,e,t.TEXTURE_WRAP_T,r.wrap),(e===t.TEXTURE_3D||o.isSampler(t,e))&&n.call(t,e,t.TEXTURE_WRAP_R,r.wrap)),r.wrapR&&n.call(t,e,t.TEXTURE_WRAP_R,r.wrapR),r.wrapS&&n.call(t,e,t.TEXTURE_WRAP_S,r.wrapS),r.wrapT&&n.call(t,e,t.TEXTURE_WRAP_T,r.wrapT),r.minLod&&n.call(t,e,t.TEXTURE_MIN_LOD,r.minLod),r.maxLod&&n.call(t,e,t.TEXTURE_MAX_LOD,r.maxLod),r.baseLevel&&n.call(t,e,t.TEXTURE_BASE_LEVEL,r.baseLevel),r.maxLevel&&n.call(t,e,t.TEXTURE_MAX_LEVEL,r.maxLevel)}function J(t,e,n){var r=n.target||t.TEXTURE_2D;t.bindTexture(r,e),Z(t,r,t.texParameteri,n)}function _(t,e,n){Z(t,e,t.samplerParameteri,n)}function $(t,e){var n=t.createSampler();return _(t,n,e),n}function tt(t,e,n,r,s,o,a){n=n||u.textureOptions,o=o||t.RGBA,a=a||t.UNSIGNED_BYTE;var c=n.target||t.TEXTURE_2D;if(r=r||n.width,s=s||n.height,t.bindTexture(c,e),function(t,e,n,r){if(!i.isWebGL2(t))return V(e)&&V(n);var s=U[r];if(!s)throw"unknown internal format";return s.colorRenderable&&s.textureFilterable}(t,r,s,o))t.generateMipmap(c);else{var l=function(t){var e=U[t];if(!e)throw"unknown internal format";return e.textureFilterable}(o)?t.LINEAR:t.NEAREST;t.texParameteri(c,t.TEXTURE_MIN_FILTER,l),t.texParameteri(c,t.TEXTURE_MAG_FILTER,l),t.texParameteri(c,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(c,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}}function et(t){return!0===t.auto||void 0===t.auto&&void 0===t.level}function nt(t,e){return(e=e||{}).cubeFaceOrder||[t.TEXTURE_CUBE_MAP_POSITIVE_X,t.TEXTURE_CUBE_MAP_NEGATIVE_X,t.TEXTURE_CUBE_MAP_POSITIVE_Y,t.TEXTURE_CUBE_MAP_NEGATIVE_Y,t.TEXTURE_CUBE_MAP_POSITIVE_Z,t.TEXTURE_CUBE_MAP_NEGATIVE_Z]}function rt(t,e){var n=nt(t,e).map((function(t,e){return{face:t,ndx:e}}));return n.sort((function(t,e){return t.face-e.face})),n}function it(t,e,n,r){var i=(r=r||u.textureOptions).target||t.TEXTURE_2D,s=r.level||0,o=n.width,c=n.height,l=r.internalFormat||r.format||t.RGBA,d=z(l),p=r.format||d.format,f=r.type||d.type;if(K(t,r),t.bindTexture(i,e),i===t.TEXTURE_CUBE_MAP){var m,g,b=n.width,y=n.height;if(b/6===y)m=y,g=[0,0,1,0,2,0,3,0,4,0,5,0];else if(y/6===b)m=b,g=[0,0,0,1,0,2,0,3,0,4,0,5];else if(b/3==y/2)m=b/3,g=[0,0,1,0,2,0,0,1,1,1,2,1];else{if(b/2!=y/3)throw"can't figure out cube map from element: "+(n.src?n.src:n.nodeName);m=b/2,g=[0,0,1,0,0,1,1,1,0,2,1,2]}h?(h.canvas.width=m,h.canvas.height=m,o=m,c=m,rt(t,r).forEach((function(e){var r=g[2*e.ndx+0]*m,i=g[2*e.ndx+1]*m;h.drawImage(n,r,i,m,m,0,0,m,m),t.texImage2D(e.face,s,l,p,f,h.canvas)})),h.canvas.width=1,h.canvas.height=1):a.default.createImageBitmap&&(o=m,c=m,rt(t,r).forEach((function(u){var h=g[2*u.ndx+0]*m,d=g[2*u.ndx+1]*m;t.texImage2D(u.face,s,l,m,m,0,p,f,null),a.default.createImageBitmap(n,h,d,m,m,{premultiplyAlpha:"none",colorSpaceConversion:"none"}).then((function(n){K(t,r),t.bindTexture(i,e),t.texImage2D(u.face,s,l,p,f,n),q(t,r),et(r)&&tt(t,e,r,o,c,l,f)}))})))}else if(i===t.TEXTURE_3D||i===t.TEXTURE_2D_ARRAY){var v=Math.min(n.width,n.height),w=Math.max(n.width,n.height),T=w/v;if(T%1!=0)throw"can not compute 3D dimensions of element";var E=n.width===w?1:0,A=n.height===w?1:0;Q(t),t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.pixelStorei(t.UNPACK_ROW_LENGTH,n.width),t.pixelStorei(t.UNPACK_IMAGE_HEIGHT,0),t.pixelStorei(t.UNPACK_SKIP_IMAGES,0),t.texImage3D(i,s,l,v,v,v,0,p,f,null);for(var k=0;k<T;++k){var I=k*v*E,S=k*v*A;t.pixelStorei(t.UNPACK_SKIP_PIXELS,I),t.pixelStorei(t.UNPACK_SKIP_ROWS,S),t.texSubImage3D(i,s,0,0,k,v,v,1,p,f,n)}X(t)}else t.texImage2D(i,s,l,p,f,n);q(t,r),et(r)&&tt(t,e,r,o,c,l,f),J(t,e,r)}function st(){}function ot(t){return a.default.ImageBitmap&&t instanceof a.default.ImageBitmap||a.default.ImageData&&t instanceof a.default.ImageData||a.default.HTMLElement&&t instanceof a.default.HTMLElement}function at(t,e,n){return ot(t)?(setTimeout((function(){n(null,t)})),t):function(t,e,n){var r;if(n=n||st,a.default.Image){r=new a.default.Image,void 0!==(e=void 0!==e?e:u.crossOrigin)&&(r.crossOrigin=e);var i=function(){r.removeEventListener("error",s),r.removeEventListener("load",c),r=null},s=function(){var e="couldn't load image: "+t;o.error(e),n(e,r),i()},c=function(){n(null,r),i()};return r.addEventListener("error",s),r.addEventListener("load",c),r.src=t,r}if(a.default.ImageBitmap){var l,h,d=function(){n(l,h)},p={};e&&(p.mode="cors"),fetch(t,p).then((function(t){if(!t.ok)throw t;return t.blob()})).then((function(t){return a.default.createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"})})).then((function(t){h=t,setTimeout(d)})).catch((function(t){l=t,setTimeout(d)})),r=null}return r}(t,e,n)}function ct(t,e,n){var r=(n=n||u.textureOptions).target||t.TEXTURE_2D;if(t.bindTexture(r,e),!1!==n.color){var i=function(t){return t=t||u.textureColor,l(t)?t:new Uint8Array([255*t[0],255*t[1],255*t[2],255*t[3]])}(n.color);if(r===t.TEXTURE_CUBE_MAP)for(var s=0;s<6;++s)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,i);else r===t.TEXTURE_3D||r===t.TEXTURE_2D_ARRAY?t.texImage3D(r,0,t.RGBA,1,1,1,0,t.RGBA,t.UNSIGNED_BYTE,i):t.texImage2D(r,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,i)}}function ut(t,e,n,r){return r=r||st,n=n||u.textureOptions,ct(t,e,n),at((n=Object.assign({},n)).src,n.crossOrigin,(function(i,s){i?r(i,e,s):(it(t,e,s,n),r(null,e,s))}))}function lt(t,e,n,r){r=r||st;var i=n.src;if(6!==i.length)throw"there must be 6 urls for a cubemap";var s=n.level||0,o=n.internalFormat||n.format||t.RGBA,a=z(o),c=n.format||a.format,u=n.type||t.UNSIGNED_BYTE,l=n.target||t.TEXTURE_2D;if(l!==t.TEXTURE_CUBE_MAP)throw"target must be TEXTURE_CUBE_MAP";ct(t,e,n),n=Object.assign({},n);var h,d=6,p=[],f=nt(t,n);h=i.map((function(i,a){return at(i,n.crossOrigin,(m=f[a],function(i,a){--d,i?p.push(i):a.width!==a.height?p.push("cubemap face img is not a square: "+a.src):(K(t,n),t.bindTexture(l,e),5===d?nt(t).forEach((function(e){t.texImage2D(e,s,o,c,u,a)})):t.texImage2D(m,s,o,c,u,a),q(t,n),et(n)&&t.generateMipmap(l)),0===d&&r(p.length?p:void 0,e,h)}));var m}))}function ht(t,e,n,r){r=r||st;var i=n.src,s=n.internalFormat||n.format||t.RGBA,o=z(s),a=n.format||o.format,c=n.type||t.UNSIGNED_BYTE,u=n.target||t.TEXTURE_2D_ARRAY;if(u!==t.TEXTURE_3D&&u!==t.TEXTURE_2D_ARRAY)throw"target must be TEXTURE_3D or TEXTURE_2D_ARRAY";ct(t,e,n),n=Object.assign({},n);var l,d=i.length,p=[],f=n.level||0,m=n.width,g=n.height,b=i.length,y=!0;l=i.map((function(i,o){return at(i,n.crossOrigin,(v=o,function(i,o){if(--d,i)p.push(i);else{if(K(t,n),t.bindTexture(u,e),y){y=!1,m=n.width||o.width,g=n.height||o.height,t.texImage3D(u,f,s,m,g,b,0,a,c,null);for(var w=0;w<b;++w)t.texSubImage3D(u,f,0,0,w,m,g,1,a,c,o)}else{var T=o;o.width===m&&o.height===g||(T=h.canvas,h.canvas.width=m,h.canvas.height=g,h.drawImage(o,0,0,m,g)),t.texSubImage3D(u,f,0,0,v,m,g,1,a,c,T),T===h.canvas&&(h.canvas.width=0,h.canvas.height=0)}q(t,n),et(n)&&t.generateMipmap(u)}0===d&&r(p.length?p:void 0,e,l)}));var v}))}function dt(t,e,n,r){var o=(r=r||u.textureOptions).target||t.TEXTURE_2D;t.bindTexture(o,e);var a=r.width,c=r.height,h=r.depth,d=r.level||0,p=r.internalFormat||r.format||t.RGBA,f=z(p),m=r.format||f.format,g=r.type||G(t,n,f.type);if(l(n))n instanceof Uint8ClampedArray&&(n=new Uint8Array(n.buffer));else{var b=s.getTypedArrayTypeForGLType(g);n=new b(n)}var y,v=F(p,g),w=n.byteLength/v;if(w%1)throw"length wrong size for format: "+i.glEnumToString(t,m);if(o===t.TEXTURE_3D)if(a||c||h)!a||c&&h?!c||a&&h?(y=Y(t,o,a,c,w/h),a=y.width,c=y.height):(y=Y(t,o,a,h,w/c),a=y.width,h=y.height):(y=Y(t,o,c,h,w/a),c=y.width,h=y.height);else{var T=Math.cbrt(w);if(T%1!=0)throw"can't guess cube size of array of numElements: "+w;a=T,c=T,h=T}else y=Y(t,o,a,c,w),a=y.width,c=y.height;if(Q(t),t.pixelStorei(t.UNPACK_ALIGNMENT,r.unpackAlignment||1),K(t,r),o===t.TEXTURE_CUBE_MAP){var E=w/6*(v/n.BYTES_PER_ELEMENT);rt(t,r).forEach((function(e){var r=E*e.ndx,i=n.subarray(r,r+E);t.texImage2D(e.face,d,p,a,c,0,m,g,i)}))}else o===t.TEXTURE_3D?t.texImage3D(o,d,p,a,c,h,0,m,g,n):t.texImage2D(o,d,p,a,c,0,m,g,n);return q(t,r),X(t),{width:a,height:c,depth:h,type:g}}function pt(t,e,n){var r=n.target||t.TEXTURE_2D;t.bindTexture(r,e);var i=n.level||0,s=n.internalFormat||n.format||t.RGBA,o=z(s),a=n.format||o.format,c=n.type||o.type;if(K(t,n),r===t.TEXTURE_CUBE_MAP)for(var u=0;u<6;++u)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+u,i,s,n.width,n.height,0,a,c,null);else r===t.TEXTURE_3D?t.texImage3D(r,i,s,n.width,n.height,n.depth,0,a,c,null):t.texImage2D(r,i,s,n.width,n.height,0,a,c,null);q(t,n)}function ft(t,e,n){n=n||st,e=e||u.textureOptions;var r=t.createTexture(),i=e.target||t.TEXTURE_2D,s=e.width||1,o=e.height||1,a=e.internalFormat||t.RGBA,c=z(a),h=e.type||c.type;t.bindTexture(i,r),i===t.TEXTURE_CUBE_MAP&&(t.texParameteri(i,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(i,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE));var d=e.src;if(d)if("function"==typeof d&&(d=d(t,e)),"string"==typeof d)ut(t,r,e,n);else if(l(d)||Array.isArray(d)&&("number"==typeof d[0]||Array.isArray(d[0])||l(d[0]))){var p=dt(t,r,d,e);s=p.width,o=p.height,h=p.type}else if(Array.isArray(d)&&("string"==typeof d[0]||ot(d[0])))i===t.TEXTURE_CUBE_MAP?lt(t,r,e,n):ht(t,r,e,n);else{if(!ot(d))throw"unsupported src type";it(t,r,d,e),s=d.width,o=d.height}else pt(t,r,e);return et(e)&&tt(t,r,e,s,o,a,h),J(t,r,e),r}},function(t,e,n){"use strict";e.__esModule=!0;var r={m4:!0,v3:!0,primitives:!0};e.primitives=e.v3=e.m4=void 0;var i=c(n(6));e.m4=i;var s=c(n(3));e.v3=s;var o=c(n(10));e.primitives=o;var a=n(11);function c(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}Object.keys(a).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(r,t)||(e[t]=a[t]))}))},function(t,e,n){"use strict";e.__esModule=!0,e.create3DFVertices=x,e.createAugmentedTypedArray=d,e.createCubeVertices=k,e.createPlaneVertices=T,e.createSphereVertices=E,e.createTruncatedConeVertices=I,e.createXYQuadVertices=w,e.createCresentVertices=O,e.createCylinderVertices=M,e.createTorusVertices=N,e.createDiscVertices=C,e.deindexVertices=function(t){var e=t.indices,n={},r=e.length;return Object.keys(t).filter(p).forEach((function(i){for(var s=t[i],o=s.numComponents,a=d(o,r,s.constructor),c=0;c<r;++c)for(var u=e[c]*o,l=0;l<o;++l)a.push(s[u+l]);n[i]=a})),n},e.flattenNormals=function(t){if(t.indices)throw"can't flatten normals of indexed vertices. deindex them first";for(var e=t.normal,n=e.length,r=0;r<n;r+=9){var i=e[r+0],s=e[r+1],o=e[r+2],a=e[r+3],c=e[r+4],u=e[r+5],l=i+a+e[r+6],h=s+c+e[r+7],d=o+u+e[r+8],p=Math.sqrt(l*l+h*h+d*d);l/=p,h/=p,d/=p,e[r+0]=l,e[r+1]=h,e[r+2]=d,e[r+3]=l,e[r+4]=h,e[r+5]=d,e[r+6]=l,e[r+7]=h,e[r+8]=d}return t},e.makeRandomVertexColors=function(t,e){e=e||{};var n=t.position.numElements,r=d(4,n,Uint8Array),i=e.rand||function(t,e){return e<3?(n=256,Math.random()*n|0):255;var n};if(t.color=r,t.indices)for(var s=0;s<n;++s)r.push(i(s,0),i(s,1),i(s,2),i(s,3));else for(var o=e.vertsPerColor||3,a=n/o,c=0;c<a;++c)for(var u=[i(c,0),i(c,1),i(c,2),i(c,3)],l=0;l<o;++l)r.push(u);return t},e.reorientDirections=g,e.reorientNormals=b,e.reorientPositions=y,e.reorientVertices=v,e.concatVertices=function(t){for(var e,n={},r=function(r){var i=t[r];Object.keys(i).forEach((function(t){n[t]||(n[t]=[]),e||"indices"===t||(e=t);var r=i[t],s=l(r,t),o=u(r).length/s;n[t].push(o)}))},i=0;i<t.length;++i)r(i);var s=n[e],o={};return Object.keys(n).forEach((function(e){var n=function(e){for(var n,r=0,i=0;i<t.length;++i){var s=t[i][e];r+=u(s).length,n&&!s.data||(n=s)}return{length:r,spec:n}}(e),r=B(n.spec,n.length);!function(e,n,r){for(var i=0,s=0,o=0;o<t.length;++o){var a=t[o][e],c=u(a);"indices"===e?(L(c,r,s,i),i+=n[o]):L(c,r,s),s+=c.length}}(e,s,u(r)),o[e]=r})),o},e.duplicateVertices=function(t){var e={};return Object.keys(t).forEach((function(n){var r=t[n],i=u(r),s=B(r,i.length);L(i,u(s),0),e[n]=s})),e},e.createDiscBuffers=e.createDiscBufferInfo=e.createTorusBuffers=e.createTorusBufferInfo=e.createCylinderBuffers=e.createCylinderBufferInfo=e.createCresentBuffers=e.createCresentBufferInfo=e.createXYQuadBuffers=e.createXYQuadBufferInfo=e.createTruncatedConeBuffers=e.createTruncatedConeBufferInfo=e.createSphereBuffers=e.createSphereBufferInfo=e.createPlaneBuffers=e.createPlaneBufferInfo=e.createCubeBuffers=e.createCubeBufferInfo=e.create3DFBuffers=e.create3DFBufferInfo=void 0;var r=c(n(7)),i=c(n(0)),s=c(n(1)),o=c(n(6)),a=c(n(3));function c(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}var u=r.getArray_,l=r.getNumComponents_;function h(t,e){var n=0;return t.push=function(){for(var e=0;e<arguments.length;++e){var r=arguments[e];if(r instanceof Array||s.isArrayBuffer(r))for(var i=0;i<r.length;++i)t[n++]=r[i];else t[n++]=r}},t.reset=function(t){n=t||0},t.numComponents=e,Object.defineProperty(t,"numElements",{get:function(){return this.length/this.numComponents|0}}),t}function d(t,e,n){return h(new(n||Float32Array)(t*e),t)}function p(t){return"indices"!==t}function f(t,e,n){for(var r=t.length,i=new Float32Array(3),s=0;s<r;s+=3)n(e,[t[s],t[s+1],t[s+2]],i),t[s]=i[0],t[s+1]=i[1],t[s+2]=i[2]}function m(t,e,n){n=n||a.create();var r=e[0],i=e[1],s=e[2];return n[0]=r*t[0]+i*t[1]+s*t[2],n[1]=r*t[4]+i*t[5]+s*t[6],n[2]=r*t[8]+i*t[9]+s*t[10],n}function g(t,e){return f(t,e,o.transformDirection),t}function b(t,e){return f(t,o.inverse(e),m),t}function y(t,e){return f(t,e,o.transformPoint),t}function v(t,e){return Object.keys(t).forEach((function(n){var r=t[n];n.indexOf("pos")>=0?y(r,e):n.indexOf("tan")>=0||n.indexOf("binorm")>=0?g(r,e):n.indexOf("norm")>=0&&b(r,e)})),t}function w(t,e,n){return t=t||2,{position:{numComponents:2,data:[(e=e||0)+-1*(t*=.5),(n=n||0)+-1*t,e+1*t,n+-1*t,e+-1*t,n+1*t,e+1*t,n+1*t]},normal:[0,0,1,0,0,1,0,0,1,0,0,1],texcoord:[0,0,1,0,0,1,1,1],indices:[0,1,2,2,1,3]}}function T(t,e,n,r,i){t=t||1,e=e||1,n=n||1,r=r||1,i=i||o.identity();for(var s=(n+1)*(r+1),a=d(3,s),c=d(3,s),u=d(2,s),l=0;l<=r;l++)for(var h=0;h<=n;h++){var p=h/n,f=l/r;a.push(t*p-.5*t,0,e*f-.5*e),c.push(0,1,0),u.push(p,f)}for(var m=n+1,g=d(3,n*r*2,Uint16Array),b=0;b<r;b++)for(var y=0;y<n;y++)g.push((b+0)*m+y,(b+1)*m+y,(b+0)*m+y+1),g.push((b+1)*m+y,(b+1)*m+y+1,(b+0)*m+y+1);return v({position:a,normal:c,texcoord:u,indices:g},i)}function E(t,e,n,r,i,s,o){if(e<=0||n<=0)throw Error("subdivisionAxis and subdivisionHeight must be > 0");r=r||0,s=s||0;for(var a=(i=i||Math.PI)-r,c=(o=o||2*Math.PI)-s,u=(e+1)*(n+1),l=d(3,u),h=d(3,u),p=d(2,u),f=0;f<=n;f++)for(var m=0;m<=e;m++){var g=m/e,b=f/n,y=c*g,v=a*b,w=Math.sin(y),T=Math.cos(y),E=Math.sin(v),A=T*E,k=Math.cos(v),I=w*E;l.push(t*A,t*k,t*I),h.push(A,k,I),p.push(1-g,b)}for(var S=e+1,x=d(3,e*n*2,Uint16Array),O=0;O<e;O++)for(var M=0;M<n;M++)x.push((M+0)*S+O,(M+0)*S+O+1,(M+1)*S+O),x.push((M+1)*S+O,(M+0)*S+O+1,(M+1)*S+O+1);return{position:l,normal:h,texcoord:p,indices:x}}var A=[[3,7,5,1],[6,2,0,4],[6,7,3,2],[0,1,5,4],[7,6,4,5],[2,3,1,0]];function k(t){for(var e=(t=t||1)/2,n=[[-e,-e,-e],[+e,-e,-e],[-e,+e,-e],[+e,+e,-e],[-e,-e,+e],[+e,-e,+e],[-e,+e,+e],[+e,+e,+e]],r=[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],i=[[1,0],[0,0],[0,1],[1,1]],s=d(3,24),o=d(3,24),a=d(2,24),c=d(3,12,Uint16Array),u=0;u<6;++u){for(var l=A[u],h=0;h<4;++h){var p=n[l[h]],f=r[u],m=i[h];s.push(p),o.push(f),a.push(m)}var g=4*u;c.push(g+0,g+1,g+2),c.push(g+0,g+2,g+3)}return{position:s,normal:o,texcoord:a,indices:c}}function I(t,e,n,r,i,s,o){if(r<3)throw Error("radialSubdivisions must be 3 or greater");if(i<1)throw Error("verticalSubdivisions must be 1 or greater");for(var a=void 0===s||s,c=void 0===o||o,u=(a?2:0)+(c?2:0),l=(r+1)*(i+1+u),h=d(3,l),p=d(3,l),f=d(2,l),m=d(3,r*(i+u)*2,Uint16Array),g=r+1,b=Math.atan2(t-e,n),y=Math.cos(b),v=Math.sin(b),w=i+(c?2:0),T=a?-2:0;T<=w;++T){var E=T/i,A=n*E,k=void 0;T<0?(A=0,E=1,k=t):T>i?(A=n,E=1,k=e):k=t+T/i*(e-t),-2!==T&&T!==i+2||(k=0,E=0),A-=n/2;for(var I=0;I<g;++I){var S=Math.sin(I*Math.PI*2/r),x=Math.cos(I*Math.PI*2/r);h.push(S*k,A,x*k),p.push(T<0||T>i?0:S*y,T<0?-1:T>i?1:v,T<0||T>i?0:x*y),f.push(I/r,1-E)}}for(var O=0;O<i+u;++O)for(var M=0;M<r;++M)m.push(g*(O+0)+0+M,g*(O+0)+1+M,g*(O+1)+1+M),m.push(g*(O+0)+0+M,g*(O+1)+1+M,g*(O+1)+0+M);return{position:h,normal:p,texcoord:f,indices:m}}function S(t,e){e=e||[];for(var n=[],r=0;r<t.length;r+=4){var i=t[r],s=t.slice(r+1,r+4);s.push.apply(s,e);for(var o=0;o<i;++o)n.push.apply(n,s)}return n}function x(){var t=[0,0,0,0,150,0,30,0,0,0,150,0,30,150,0,30,0,0,30,0,0,30,30,0,100,0,0,30,30,0,100,30,0,100,0,0,30,60,0,30,90,0,67,60,0,30,90,0,67,90,0,67,60,0,0,0,30,30,0,30,0,150,30,0,150,30,30,0,30,30,150,30,30,0,30,100,0,30,30,30,30,30,30,30,100,0,30,100,30,30,30,60,30,67,60,30,30,90,30,30,90,30,67,60,30,67,90,30,0,0,0,100,0,0,100,0,30,0,0,0,100,0,30,0,0,30,100,0,0,100,30,0,100,30,30,100,0,0,100,30,30,100,0,30,30,30,0,30,30,30,100,30,30,30,30,0,100,30,30,100,30,0,30,30,0,30,60,30,30,30,30,30,30,0,30,60,0,30,60,30,30,60,0,67,60,30,30,60,30,30,60,0,67,60,0,67,60,30,67,60,0,67,90,30,67,60,30,67,60,0,67,90,0,67,90,30,30,90,0,30,90,30,67,90,30,30,90,0,67,90,30,67,90,0,30,90,0,30,150,30,30,90,30,30,90,0,30,150,0,30,150,30,0,150,0,0,150,30,30,150,30,0,150,0,30,150,30,30,150,0,0,0,0,0,0,30,0,150,30,0,0,0,0,150,30,0,150,0],e=S([18,0,0,1,18,0,0,-1,6,0,1,0,6,1,0,0,6,0,-1,0,6,1,0,0,6,0,1,0,6,1,0,0,6,0,-1,0,6,1,0,0,6,0,-1,0,6,-1,0,0]),n=S([18,200,70,120,18,80,70,200,6,70,200,210,6,200,200,70,6,210,100,70,6,210,160,70,6,70,180,210,6,100,70,210,6,76,210,100,6,140,210,80,6,90,130,110,6,160,160,220],[255]),r=t.length/3,i={position:d(3,r),texcoord:d(2,r),normal:d(3,r),color:d(4,r,Uint8Array),indices:d(3,r/3,Uint16Array)};i.position.push(t),i.texcoord.push([.22,.19,.22,.79,.34,.19,.22,.79,.34,.79,.34,.19,.34,.19,.34,.31,.62,.19,.34,.31,.62,.31,.62,.19,.34,.43,.34,.55,.49,.43,.34,.55,.49,.55,.49,.43,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,0,1,1,1,0,0,1,1,1,0]),i.normal.push(e),i.color.push(n);for(var s=0;s<r;++s)i.indices.push(s);return i}function O(t,e,n,r,i,s,o){if(i<=0)throw Error("subdivisionDown must be > 0");var c=(o=o||1)-(s=s||0),u=2*(i+1)*4,l=d(3,u),h=d(3,u),p=d(2,u);function f(t,e,n){return t+(e-t)*n}function m(e,n,o,u,d,m){for(var g=0;g<=i;g++){var b=n/1,y=g/i,v=2*(b-.5),w=(s+y*c)*Math.PI,T=Math.sin(w),E=Math.cos(w),A=f(t,e,T),k=v*r,I=E*t,S=T*A;l.push(k,I,S);var x=a.add(a.multiply([0,T,E],o),u);h.push(x),p.push(b*d+m,y)}}for(var g=0;g<2;g++){var b=2*(g/1-.5);m(e,g,[1,1,1],[0,0,0],1,0),m(e,g,[0,0,0],[b,0,0],0,0),m(n,g,[1,1,1],[0,0,0],1,0),m(n,g,[0,0,0],[b,0,0],0,1)}var y=d(3,2*i*4,Uint16Array);function v(t,e){for(var n=0;n<i;++n)y.push(t+n+0,t+n+1,e+n+0),y.push(t+n+1,e+n+1,e+n+0)}var w=i+1;return v(0*w,4*w),v(5*w,7*w),v(6*w,2*w),v(3*w,1*w),{position:l,normal:h,texcoord:p,indices:y}}function M(t,e,n,r,i,s){return I(t,t,e,n,r,i,s)}function N(t,e,n,r,i,s){if(n<3)throw Error("radialSubdivisions must be 3 or greater");if(r<3)throw Error("verticalSubdivisions must be 3 or greater");i=i||0;for(var o=(s=s||2*Math.PI)-i,a=n+1,c=r+1,u=a*c,l=d(3,u),h=d(3,u),p=d(2,u),f=d(3,n*r*2,Uint16Array),m=0;m<c;++m)for(var g=m/r,b=g*Math.PI*2,y=Math.sin(b),v=t+y*e,w=Math.cos(b),T=w*e,E=0;E<a;++E){var A=E/n,k=i+A*o,I=Math.sin(k),S=Math.cos(k),x=I*v,O=S*v,M=I*y,N=S*y;l.push(x,T,O),h.push(M,w,N),p.push(A,1-g)}for(var C=0;C<r;++C)for(var R=0;R<n;++R){var D=1+R,P=1+C;f.push(a*C+R,a*P+R,a*C+D),f.push(a*P+R,a*P+D,a*C+D)}return{position:l,normal:h,texcoord:p,indices:f}}function C(t,e,n,r,i){if(e<3)throw Error("divisions must be at least 3");i=i||1,r=r||0;for(var s=(e+1)*((n=n||1)+1),o=d(3,s),a=d(3,s),c=d(2,s),u=d(3,n*e*2,Uint16Array),l=0,h=t-r,p=e+1,f=0;f<=n;++f){for(var m=r+h*Math.pow(f/n,i),g=0;g<=e;++g){var b=2*Math.PI*g/e,y=m*Math.cos(b),v=m*Math.sin(b);if(o.push(y,0,v),a.push(0,1,0),c.push(1-g/e,f/n),f>0&&g!==e){var w=l+(g+1),T=l+g,E=l+g-p,A=l+(g+1)-p;u.push(w,T,E),u.push(w,E,A)}}l+=e+1}return{position:o,normal:a,texcoord:c,indices:u}}function R(t){return function(e){var n=t.apply(this,Array.prototype.slice.call(arguments,1));return r.createBuffersFromArrays(e,n)}}function D(t){return function(e){var n=t.apply(null,Array.prototype.slice.call(arguments,1));return r.createBufferInfoFromArrays(e,n)}}var P=["numComponents","size","type","normalize","stride","offset","attrib","name","attribName"];function L(t,e,n,r){r=r||0;for(var i=t.length,s=0;s<i;++s)e[n+s]=t[s]+r}function B(t,e){var n=u(t),r=new n.constructor(e),s=r;return n.numComponents&&n.numElements&&h(r,n.numComponents),t.data&&(s={data:r},i.copyNamedProperties(P,t,s)),s}var U=D(x);e.create3DFBufferInfo=U;var j=R(x);e.create3DFBuffers=j;var F=D(k);e.createCubeBufferInfo=F;var z=R(k);e.createCubeBuffers=z;var V=D(T);e.createPlaneBufferInfo=V;var G=R(T);e.createPlaneBuffers=G;var Y=D(E);e.createSphereBufferInfo=Y;var H=R(E);e.createSphereBuffers=H;var W=D(I);e.createTruncatedConeBufferInfo=W;var K=R(I);e.createTruncatedConeBuffers=K;var q=D(w);e.createXYQuadBufferInfo=q;var Q=R(w);e.createXYQuadBuffers=Q;var X=D(O);e.createCresentBufferInfo=X;var Z=R(O);e.createCresentBuffers=Z;var J=D(M);e.createCylinderBufferInfo=J;var _=R(M);e.createCylinderBuffers=_;var $=D(N);e.createTorusBufferInfo=$;var tt=R(N);e.createTorusBuffers=tt;var et=D(C);e.createDiscBufferInfo=et;var nt=R(C);e.createDiscBuffers=nt},function(t,e,n){"use strict";e.__esModule=!0;var r={addExtensionsToContext:!0,getContext:!0,getWebGLContext:!0,resizeCanvasToDisplaySize:!0,setDefaults:!0};e.addExtensionsToContext=y,e.getContext=function(t,e){var n=function(t,e){for(var n=["webgl2","webgl","experimental-webgl"],r=null,i=0;i<n.length;++i)if(r=t.getContext(n[i],e)){f.addExtensionsToContext&&y(r);break}return r}(t,e);return n},e.getWebGLContext=function(t,e){var n=function(t,e){for(var n=["webgl","experimental-webgl"],r=null,i=0;i<n.length;++i)if(r=t.getContext(n[i],e)){f.addExtensionsToContext&&y(r);break}return r}(t,e);return n},e.resizeCanvasToDisplaySize=function(t,e){e=e||1,e=Math.max(0,e);var n=t.clientWidth*e|0,r=t.clientHeight*e|0;return(t.width!==n||t.height!==r)&&(t.width=n,t.height=r,!0)},e.setDefaults=function(t){o.copyExistingProperties(t,f),i.setAttributeDefaults_(t),s.setTextureDefaults_(t)};var i=p(n(7));Object.keys(i).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(r,t)||(e[t]=i[t]))}));var s=p(n(8));Object.keys(s).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(r,t)||(e[t]=s[t]))}));var o=p(n(0)),a=p(n(4));Object.keys(a).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(r,t)||(e[t]=a[t]))}));var c=n(12);Object.keys(c).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(r,t)||(e[t]=c[t]))}));var u=n(13);Object.keys(u).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(r,t)||(e[t]=u[t]))}));var l=n(5);Object.keys(l).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(r,t)||(e[t]=l[t]))}));var h=n(1);Object.keys(h).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(r,t)||(e[t]=h[t]))}));var d=n(14);function p(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}Object.keys(d).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(r,t)||(e[t]=d[t]))}));var f={addExtensionsToContext:!0},m=/^(.*?)_/;function g(t,e){a.glEnumToString(t,0);var n=t.getExtension(e);if(n){var r={},i=m.exec(e)[1],s="_"+i;for(var c in n){var u=n[c],l="function"==typeof u,h=l?i:s,d=c;c.endsWith(h)&&(d=c.substring(0,c.length-h.length)),void 0!==t[d]?l||t[d]===u||o.warn(d,t[d],u,c):l?t[d]=function(t){return function(){return t.apply(n,arguments)}}(u):(t[d]=u,r[d]=u)}r.constructor={name:n.constructor.name},a.glEnumToString(r,0)}return n}var b=["ANGLE_instanced_arrays","EXT_blend_minmax","EXT_color_buffer_float","EXT_color_buffer_half_float","EXT_disjoint_timer_query","EXT_disjoint_timer_query_webgl2","EXT_frag_depth","EXT_sRGB","EXT_shader_texture_lod","EXT_texture_filter_anisotropic","OES_element_index_uint","OES_standard_derivatives","OES_texture_float","OES_texture_float_linear","OES_texture_half_float","OES_texture_half_float_linear","OES_vertex_array_object","WEBGL_color_buffer_float","WEBGL_compressed_texture_atc","WEBGL_compressed_texture_etc1","WEBGL_compressed_texture_pvrtc","WEBGL_compressed_texture_s3tc","WEBGL_compressed_texture_s3tc_srgb","WEBGL_depth_texture","WEBGL_draw_buffers"];function y(t){for(var e=0;e<b.length;++e)g(t,b[e])}},function(t,e,n){"use strict";e.__esModule=!0,e.drawBufferInfo=i,e.drawObjectList=function(t,e){var n=null,s=null;e.forEach((function(e){if(!1!==e.active){var o=e.programInfo,a=e.vertexArrayInfo||e.bufferInfo,c=!1,u=void 0===e.type?t.TRIANGLES:e.type;o!==n&&(n=o,t.useProgram(o.program),c=!0),(c||a!==s)&&(s&&s.vertexArrayObject&&!a.vertexArrayObject&&t.bindVertexArray(null),s=a,r.setBuffersAndAttributes(t,o,a)),r.setUniforms(o,e.uniforms),i(t,a,u,e.count,e.offset,e.instanceCount)}})),s.vertexArrayObject&&t.bindVertexArray(null)};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}(n(5));function i(t,e,n,r,i,s){n=void 0===n?t.TRIANGLES:n;var o=e.indices,a=e.elementType,c=void 0===r?e.numElements:r;i=void 0===i?0:i,a||o?void 0!==s?t.drawElementsInstanced(n,c,void 0===a?t.UNSIGNED_SHORT:e.elementType,i,s):t.drawElements(n,c,void 0===a?t.UNSIGNED_SHORT:e.elementType,i):void 0!==s?t.drawArraysInstanced(n,i,c,s):t.drawArrays(n,i,c)}},function(t,e,n){"use strict";e.__esModule=!0,e.bindFramebufferInfo=function(t,e,n){n=n||t.FRAMEBUFFER,e?(t.bindFramebuffer(n,e.framebuffer),t.viewport(0,0,e.width,e.height)):(t.bindFramebuffer(n,null),t.viewport(0,0,t.drawingBufferWidth,t.drawingBufferHeight))},e.createFramebufferInfo=function(t,e,n,s){var o=t.FRAMEBUFFER,h=t.createFramebuffer();t.bindFramebuffer(o,h),n=n||t.drawingBufferWidth,s=s||t.drawingBufferHeight;var d=0,p={framebuffer:h,attachments:[],width:n,height:s};return(e=e||c).forEach((function(e){var c=e.attachment,h=e.format,f=function(t){return u[t]}(h);if(f||(f=a+d++),!c)if(function(t){return l[t]}(h))c=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,c),t.renderbufferStorage(t.RENDERBUFFER,h,n,s);else{var m=Object.assign({},e);m.width=n,m.height=s,void 0===m.auto&&(m.auto=!1,m.min=m.min||m.minMag||t.LINEAR,m.mag=m.mag||m.minMag||t.LINEAR,m.wrapS=m.wrapS||m.wrap||t.CLAMP_TO_EDGE,m.wrapT=m.wrapT||m.wrap||t.CLAMP_TO_EDGE),c=r.createTexture(t,m)}if(i.isRenderbuffer(t,c))t.framebufferRenderbuffer(o,f,t.RENDERBUFFER,c);else{if(!i.isTexture(t,c))throw"unknown attachment type";t.framebufferTexture2D(o,f,e.texTarget||t.TEXTURE_2D,c,e.level||0)}p.attachments.push(c)})),p},e.resizeFramebufferInfo=function(t,e,n,s,o){s=s||t.drawingBufferWidth,o=o||t.drawingBufferHeight,e.width=s,e.height=o,(n=n||c).forEach((function(n,a){var c=e.attachments[a],u=n.format;if(i.isRenderbuffer(t,c))t.bindRenderbuffer(t.RENDERBUFFER,c),t.renderbufferStorage(t.RENDERBUFFER,u,s,o);else{if(!i.isTexture(t,c))throw"unknown attachment type";r.resizeTexture(t,c,n,s,o)}}))};var r=s(n(8)),i=s(n(0));function s(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}var o=34041,a=36064,c=[{format:6408,type:5121,min:9729,wrap:33071},{format:o}],u={34041:33306,6401:36128,36168:36128,6402:36096,33189:36096},l={32854:!0,32855:!0,36194:!0,34041:!0,33189:!0,6401:!0,36168:!0}},function(t,e,n){"use strict";e.__esModule=!0,e.createVertexArrayInfo=function(t,e,n){var i=t.createVertexArray();return t.bindVertexArray(i),e.length||(e=[e]),e.forEach((function(e){r.setBuffersAndAttributes(t,e,n)})),t.bindVertexArray(null),{numElements:n.numElements,elementType:n.elementType,vertexArrayObject:i}},e.createVAOAndSetAttributes=i,e.createVAOFromBufferInfo=function(t,e,n){return i(t,e.attribSetters||e,n.attribs,n.indices)};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}(n(5));function i(t,e,n,i){var s=t.createVertexArray();return t.bindVertexArray(s),r.setAttributes(e,n),i&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,i),t.bindVertexArray(null),s}}])},t.exports=r()},function(t,e){t.exports=class{static simple(t){return JSON.parse(JSON.stringify(t))}}},function(t,e){class n{static get BACKGROUND_LAYER(){return"background"}static get VIDEO_LAYER(){return"video"}static get PEN_LAYER(){return"pen"}static get SPRITE_LAYER(){return"sprite"}static get LAYER_GROUPS(){return[n.BACKGROUND_LAYER,n.VIDEO_LAYER,n.PEN_LAYER,n.SPRITE_LAYER]}}t.exports=n},function(t,e,n){(function(e){class n{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.nowObj;this.startTime=0,this.nowObj=t}static get USE_PERFORMANCE(){return!1}static get legacyDateCode(){return{now:function(){return(new Date).getTime()}}}static get nowObj(){return n.USE_PERFORMANCE&&"undefined"!=typeof self&&self.performance&&"now"in self.performance?self.performance:Date.now?Date:n.legacyDateCode}time(){return this.nowObj.now()}start(){this.startTime=this.nowObj.now()}timeElapsed(){return this.nowObj.now()-this.startTime}setTimeout(t,n){return e.setTimeout(t,n)}clearTimeout(t){e.clearTimeout(t)}}t.exports=n}).call(this,n(8))},function(t,e,n){const r=n(112),i=n(114);class s{static base64ToUint8Array(t){const e=r(t),n=e.length,i=new Uint8Array(n);for(let t=0;t<n;t++)i[t]=e.charCodeAt(t);return i}static uint8ArrayToBase64(t){let e="";const n=t.length;for(let r=0;r<n;r++)e+=String.fromCharCode(t[r]);return i(e)}static arrayBufferToBase64(t){return s.uint8ArrayToBase64(new Uint8Array(t))}}t.exports=s},function(t,e,n){const r=n(182),i=n(61),s=n(29),o=n(40),a=n(11),{Map:c}=n(21),u=n(63),l=n(64),h=n(0),d=n(9),p=n(41);class f{constructor(t,e){this.runtime=t,this._blocks={},this._scripts=[],Object.defineProperty(this,"_cache",{writable:!0,enumerable:!1}),this._cache={inputs:{},procedureParamNames:{},procedureDefinitions:{},_executeCached:{},_monitored:null,scripts:{},compiledScripts:{},compiledProcedures:{},proceduresPopulated:!1},this.forceNoGlow=e||!1}getCachedCompileResult(t){return Object.prototype.hasOwnProperty.call(this._cache.compiledScripts,t)?this._cache.compiledScripts[t]:null}cacheCompileResult(t,e){this._cache.compiledScripts[t]={success:!0,value:e}}cacheCompileError(t,e){this._cache.compiledScripts[t]={success:!1,value:e}}static get BRANCH_INPUT_PREFIX(){return"SUBSTACK"}getBlock(t){return this._blocks[t]}getScripts(){return this._scripts}getNextBlock(t){const e=this._blocks[t];return void 0===e?null:e.next}getBranch(t,e){const n=this._blocks[t];if(void 0===n)return null;e||(e=1);let r=f.BRANCH_INPUT_PREFIX;e>1&&(r+=e);const i=n.inputs[r];return void 0===i?null:i.block}getOpcode(t){return void 0===t?null:t.opcode}getFields(t){return void 0===t?null:t.fields}getInputs(t){if(void 0===t)return null;let e=this._cache.inputs[t.id];if(void 0!==e)return e;e={};for(const n in t.inputs)n.substring(0,f.BRANCH_INPUT_PREFIX.length)!==f.BRANCH_INPUT_PREFIX&&(e[n]=t.inputs[n]);return this._cache.inputs[t.id]=e,e}getMutation(t){return void 0===t?null:t.mutation}getTopLevelScript(t){let e=this._blocks[t];if(void 0===e)return null;for(;null!==e.parent;)e=this._blocks[e.parent];return e.id}getProcedureDefinition(t){const e=this._cache.procedureDefinitions[t];if(void 0!==e)return e;for(const e in this._blocks){if(!Object.prototype.hasOwnProperty.call(this._blocks,e))continue;const n=this._blocks[e];if("procedures_definition"===n.opcode){const r=this._getCustomBlockInternal(n);if(r&&r.mutation.proccode===t)return this._cache.procedureDefinitions[t]=e,e}}return this._cache.procedureDefinitions[t]=null,null}getProcedureParamNamesAndIds(t){return this.getProcedureParamNamesIdsAndDefaults(t).slice(0,2)}getProcedureParamNamesIdsAndDefaults(t){const e=this._cache.procedureParamNames[t];if(void 0!==e)return e;for(const e in this._blocks){if(!Object.prototype.hasOwnProperty.call(this._blocks,e))continue;const n=this._blocks[e];if("procedures_prototype"===n.opcode&&n.mutation.proccode===t){const e=JSON.parse(n.mutation.argumentnames),r=JSON.parse(n.mutation.argumentids),i=JSON.parse(n.mutation.argumentdefaults);return this._cache.procedureParamNames[t]=[e,r,i],this._cache.procedureParamNames[t]}}const n=this.runtime.getAddonBlock(t);return n?(this._cache.procedureParamNames[t]=n.namesIdsDefaults,n.namesIdsDefaults):(this._cache.procedureParamNames[t]=null,null)}populateProcedureCache(){if(!this._cache.proceduresPopulated){for(const t in this._blocks){if(!Object.prototype.hasOwnProperty.call(this._blocks,t))continue;const e=this._blocks[t];if("procedures_prototype"!==e.opcode){if("procedures_definition"===e.opcode){const n=this._getCustomBlockInternal(e);if(n){const e=n.mutation.proccode;this._cache.procedureDefinitions[e]||(this._cache.procedureDefinitions[e]=t);continue}}}else{const t=e.mutation.proccode;if(!this._cache.procedureParamNames[t]){const n=JSON.parse(e.mutation.argumentnames),r=JSON.parse(e.mutation.argumentids),i=JSON.parse(e.mutation.argumentdefaults);this._cache.procedureParamNames[t]=[n,r,i]}}}this._cache.proceduresPopulated=!0}}duplicate(){const t=new f(this.runtime,this.forceNoGlow);return t._blocks=a.simple(this._blocks),t._scripts=a.simple(this._scripts),t}blocklyListen(t){if("object"!=typeof t)return;if("string"!=typeof t.blockId&&"string"!=typeof t.varId&&"string"!=typeof t.commentId)return;const e=this.runtime.getTargetForStage(),n=this.runtime.getEditingTarget();if("stackclick"!==t.element)switch(t.type){case"create":{const e=r(t);for(let t=0;t<e.length;t++)this.createBlock(e[t]);break}case"change":this.changeBlock({id:t.blockId,element:t.element,name:t.name,value:t.newValue});break;case"move":this.moveBlock({id:t.blockId,oldParent:t.oldParentId,oldInput:t.oldInputName,newParent:t.newParentId,newInput:t.newInputName,newCoordinate:t.newCoordinate});break;case"dragOutside":this.runtime.emitBlockDragUpdate(t.isOutside);break;case"endDrag":if(this.runtime.emitBlockDragUpdate(!1),t.isOutside){const e=r(t);this.runtime.emitBlockEndDrag(e,t.blockId)}break;case"delete":if(!Object.prototype.hasOwnProperty.call(this._blocks,t.blockId)||this._blocks[t.blockId].shadow)return;this._blocks[t.blockId].topLevel&&this.runtime.quietGlow(t.blockId),this.deleteBlock(t.blockId);break;case"var_create":if(this.resetCache(),t.isLocal&&n&&!n.isStage&&!t.isCloud)n.lookupVariableById(t.varId)||(n.createVariable(t.varId,t.varName,t.varType),this.emitProjectChanged());else{if(e.lookupVariableById(t.varId))return;const n=this.runtime.targets.filter((t=>t.isOriginal));for(const e of n)if(e.lookupVariableByNameAndType(t.varName,t.varType,!0))return;e.createVariable(t.varId,t.varName,t.varType,t.isCloud),this.emitProjectChanged()}break;case"var_rename":if(n&&Object.prototype.hasOwnProperty.call(n.variables,t.varId))n.renameVariable(t.varId,t.newName),n.blocks.updateBlocksAfterVarRename(t.varId,t.newName);else{e.renameVariable(t.varId,t.newName);const n=this.runtime.targets;for(let e=0;e<n.length;e++){n[e].blocks.updateBlocksAfterVarRename(t.varId,t.newName)}}this.emitProjectChanged();break;case"var_delete":this.resetCache();(n&&Object.prototype.hasOwnProperty.call(n.variables,t.varId)?n:e).deleteVariable(t.varId),this.emitProjectChanged();break;case"comment_create":if(this.resetCache(),this.runtime.getEditingTarget()){const e=this.runtime.getEditingTarget();e.createComment(t.commentId,t.blockId,t.text,t.xy.x,t.xy.y,t.width,t.height,t.minimized),null===e.comments[t.commentId].x&&null===e.comments[t.commentId].y&&(e.comments[t.commentId].x=t.xy.x,e.comments[t.commentId].y=t.xy.y)}this.emitProjectChanged();break;case"comment_change":if(this.resetCache(),this.runtime.getEditingTarget()){const e=this.runtime.getEditingTarget();if(!Object.prototype.hasOwnProperty.call(e.comments,t.commentId))return void h.warn("Cannot change comment with id ".concat(t.commentId," because it does not exist."));const n=e.comments[t.commentId],r=t.newContents_;Object.prototype.hasOwnProperty.call(r,"minimized")&&(n.minimized=r.minimized),Object.prototype.hasOwnProperty.call(r,"width")&&Object.prototype.hasOwnProperty.call(r,"height")&&(n.width=r.width,n.height=r.height),Object.prototype.hasOwnProperty.call(r,"text")&&(n.text=r.text),this.emitProjectChanged()}break;case"comment_move":if(this.runtime.getEditingTarget()){const e=this.runtime.getEditingTarget();if(e&&!Object.prototype.hasOwnProperty.call(e.comments,t.commentId))return void h.warn("Cannot change comment with id ".concat(t.commentId," because it does not exist."));const n=e.comments[t.commentId],r=t.newCoordinate_;n.x=r.x,n.y=r.y,this.emitProjectChanged()}break;case"comment_delete":if(this.resetCache(),this.runtime.getEditingTarget()){const e=this.runtime.getEditingTarget();if(!Object.prototype.hasOwnProperty.call(e.comments,t.commentId))return;if(delete e.comments[t.commentId],t.blockId){const n=e.blocks.getBlock(t.blockId);if(!n)return void h.warn("Could not find block referenced by comment with id: ".concat(t.commentId));delete n.comment}this.emitProjectChanged()}}else this.runtime.toggleScript(t.blockId,{stackClick:!0})}resetCache(){this._cache.inputs={},this._cache.procedureParamNames={},this._cache.procedureDefinitions={},this._cache._executeCached={},this._cache._monitored=null,this._cache.scripts={},this._cache.compiledScripts={},this._cache.compiledProcedures={},this._cache.proceduresPopulated=!1}emitProjectChanged(){this.forceNoGlow||this.runtime.emitProjectChanged()}createBlock(t){Object.prototype.hasOwnProperty.call(this._blocks,t.id)||(this._blocks[t.id]=t,t.topLevel&&this._addScript(t.id),this.resetCache(),this.emitProjectChanged())}changeBlock(t){if(-1===["field","mutation","checkbox"].indexOf(t.element))return;let e=this._blocks[t.id];if(void 0!==e){switch(t.element){case"field":if(!e.fields[t.name])return;if("VARIABLE"===t.name||"LIST"===t.name||"BROADCAST_OPTION"===t.name){const n=this.runtime.getEditingTarget().lookupVariableById(t.value);n&&(e.fields[t.name].value=n.name,e.fields[t.name].id=t.value)}else{e.fields[t.name].value=t.value,"sensing_of_object_menu"===e.opcode&&("_stage_"===e.fields.OBJECT.value?this._blocks[e.parent].fields.PROPERTY.value="backdrop #":this._blocks[e.parent].fields.PROPERTY.value="x position",this.runtime.requestBlocksUpdate());const n=e.shadow&&e.parent?this._blocks[e.parent]:e;n.isMonitored&&this.runtime.requestUpdateMonitor(c({id:n.id,params:this._getBlockParams(n)}))}break;case"mutation":e.mutation=i(t.value);break;case"checkbox":{if(e.fields&&Object.keys(e.fields).length>0&&"data_variable"!==e.opcode&&"data_listcontents"!==e.opcode){const t=p(e.id,e.fields);let n=this.runtime.monitorBlocks.getBlock(t);n||(n=JSON.parse(JSON.stringify(e)),n.id=t,this.runtime.monitorBlocks.createBlock(n)),e=n}const n=e.isMonitored;e.isMonitored=t.value;let r=!1;"data_variable"===e.opcode?r=!this.runtime.getTargetForStage().variables[e.fields.VARIABLE.id]:"data_listcontents"===e.opcode&&(r=!this.runtime.getTargetForStage().variables[e.fields.LIST.id]);const i=r||Object.prototype.hasOwnProperty.call(this.runtime.monitorBlockInfo,e.opcode)&&this.runtime.monitorBlockInfo[e.opcode].isSpriteSpecific;e.targetId=i?e.targetId||this.runtime.getEditingTarget().id:null,n&&!e.isMonitored?this.runtime.requestHideMonitor(e.id):!n&&e.isMonitored&&(this.runtime.requestShowMonitor(e.id)||this.runtime.requestAddMonitor(o({id:e.id,targetId:e.targetId,spriteName:e.targetId?this.runtime.getTargetById(e.targetId).getName():null,opcode:e.opcode,params:this._getBlockParams(e),value:"",mode:"data_listcontents"===e.opcode?"list":"default"})));break}}this.emitProjectChanged(),this.resetCache()}}moveBlock(t){if(!Object.prototype.hasOwnProperty.call(this._blocks,t.id))return;const e=this._blocks[t.id];let n=!1;if(t.newCoordinate&&(n=e.x!==t.newCoordinate.x||e.y!==t.newCoordinate.y,e.x=t.newCoordinate.x,e.y=t.newCoordinate.y),void 0!==t.oldParent){const e=this._blocks[t.oldParent];void 0!==t.oldInput&&e.inputs[t.oldInput].block===t.id?e.inputs[t.oldInput].block=null:e.next===t.id&&(e.next=null),this._blocks[t.id].parent=null,n=!0}if(void 0===t.newParent)this._addScript(t.id);else{if(this._deleteScript(t.id),void 0===t.newInput)this._blocks[t.newParent].next=t.id;else{let e=null;Object.prototype.hasOwnProperty.call(this._blocks[t.newParent].inputs,t.newInput)&&(e=this._blocks[t.newParent].inputs[t.newInput].shadow),this._blocks[t.id].shadow&&(e=t.id),this._blocks[t.newParent].inputs[t.newInput]={name:t.newInput,block:t.id,shadow:e}}this._blocks[t.id].parent=t.newParent,n=!0}this.resetCache(),n&&this.emitProjectChanged()}runAllMonitored(t){null===this._cache._monitored&&(this._cache._monitored=Object.keys(this._blocks).filter((t=>this.getBlock(t).isMonitored)).map((e=>{const n=this.getBlock(e).targetId;return{blockId:e,target:n?t.getTargetById(n):null}})));const e=this._cache._monitored;for(let n=0;n<e.length;n++){const{blockId:r,target:i}=e[n];t.addMonitorScript(r,i)}}deleteBlock(t){const e=this._blocks[t];if(e){null!==e.next&&this.deleteBlock(e.next);for(const t in e.inputs)null!==e.inputs[t].block&&this.deleteBlock(e.inputs[t].block),null!==e.inputs[t].shadow&&e.inputs[t].shadow!==e.inputs[t].block&&this.deleteBlock(e.inputs[t].shadow);this._deleteScript(t),delete this._blocks[t],this.resetCache(),this.emitProjectChanged()}}deleteAllBlocks(){Object.keys(this._blocks).forEach((t=>this.deleteBlock(t)))}getAllVariableAndListReferences(t,e){const n=t||this._blocks,r=Object.create(null);for(const t in n){let i=null,s=null;if(n[t].fields.VARIABLE?(i=n[t].fields.VARIABLE,s=d.SCALAR_TYPE):n[t].fields.LIST?(i=n[t].fields.LIST,s=d.LIST_TYPE):e&&n[t].fields.BROADCAST_OPTION&&(i=n[t].fields.BROADCAST_OPTION,s=d.BROADCAST_MESSAGE_TYPE),i){const t=i.id;r[t]?r[t].push({referencingField:i,type:s}):r[t]=[{referencingField:i,type:s}]}}return r}updateBlocksAfterVarRename(t,e){const n=this._blocks;for(const r in n){let i=null;if(n[r].fields.VARIABLE?i=n[r].fields.VARIABLE:n[r].fields.LIST&&(i=n[r].fields.LIST),i){t===i.id&&(i.value=e)}}}updateTargetSpecificBlocks(t){const e=this._blocks;for(const n in e)t&&"event_whenthisspriteclicked"===e[n].opcode?e[n].opcode="event_whenstageclicked":t||"event_whenstageclicked"!==e[n].opcode||(e[n].opcode="event_whenthisspriteclicked")}updateAssetName(t,e,n){let r;if("costume"===n)r=this._getCostumeField.bind(this);else if("sound"===n)r=this._getSoundField.bind(this);else if("backdrop"===n)r=this._getBackdropField.bind(this);else{if("sprite"!==n)return;r=this._getSpriteField.bind(this)}const i=this._blocks;for(const n in i){const i=r(n);i&&i.value===t&&(i.value=e)}this.resetCache()}updateSensingOfReference(t,e,n){const r=this._blocks;let i=!1;for(const s in r){const o=r[s];if("sensing_of"===o.opcode&&o.fields.PROPERTY.value===t&&o.inputs.OBJECT.block===o.inputs.OBJECT.shadow){this.getBlock(o.inputs.OBJECT.block).fields.OBJECT.value===n&&(o.fields.PROPERTY.value=e,i=!0)}}return i&&this.resetCache(),i}_getCostumeField(t){const e=this.getBlock(t);return e&&Object.prototype.hasOwnProperty.call(e.fields,"COSTUME")?e.fields.COSTUME:null}_getSoundField(t){const e=this.getBlock(t);return e&&Object.prototype.hasOwnProperty.call(e.fields,"SOUND_MENU")?e.fields.SOUND_MENU:null}_getBackdropField(t){const e=this.getBlock(t);return e&&Object.prototype.hasOwnProperty.call(e.fields,"BACKDROP")?e.fields.BACKDROP:null}_getSpriteField(t){const e=this.getBlock(t);if(!e)return null;const n=["TOWARDS","TO","OBJECT","VIDEOONMENU2","DISTANCETOMENU","TOUCHINGOBJECTMENU","CLONE_OPTION"];for(let t=0;t<n.length;t++){const r=n[t];if(Object.prototype.hasOwnProperty.call(e.fields,r))return e.fields[r]}return null}toXML(t){return this._scripts.map((e=>this.blockToXML(e,t))).join()}blockToXML(t,e){const n=this._blocks[t];if(!n)return;const r=n.shadow?"shadow":"block";let i="<".concat(r,'\n                id="').concat(s(n.id),'"\n                type="').concat(s(n.opcode),'"\n                ').concat(n.topLevel?'x="'.concat(n.x,'" y="').concat(n.y,'"'):"","\n            >");const o=n.comment;o&&(e?Object.prototype.hasOwnProperty.call(e,o)?i+=e[o].toXML():h.warn("Could not find comment with id: ".concat(o," in provided comment descriptions.")):h.warn("Cannot serialize comment with id: ".concat(o,"; no comment descriptions provided."))),n.mutation&&(i+=this.mutationToXML(n.mutation));for(const t in n.inputs){if(!Object.prototype.hasOwnProperty.call(n.inputs,t))continue;const r=n.inputs[t];(r.block||r.shadow)&&(i+='<value name="'.concat(s(r.name),'">'),r.block&&(i+=this.blockToXML(r.block,e)),r.shadow&&r.shadow!==r.block&&(i+=this.blockToXML(r.shadow,e)),i+="</value>")}for(const t in n.fields){if(!Object.prototype.hasOwnProperty.call(n.fields,t))continue;const e=n.fields[t];i+='<field name="'.concat(s(e.name),'"');const r=e.id;r&&(i+=' id="'.concat(s(r),'"'));const o=e.variableType;"string"==typeof o&&(i+=' variabletype="'.concat(s(o),'"'));let a=e.value;"string"==typeof a&&(a=s(e.value)),i+=">".concat(a,"</field>")}return n.next&&(i+="<next>".concat(this.blockToXML(n.next,e),"</next>")),i+="</".concat(r,">"),i}mutationToXML(t){let e="<".concat(t.tagName);for(const n in t){if("children"===n||"tagName"===n)continue;let r="string"==typeof t[n]?s(t[n]):t[n];"blockInfo"===n&&(r=s(JSON.stringify(t[n]))),e+=" ".concat(n,'="').concat(r,'"')}e+=">";for(let n=0;n<t.children.length;n++)e+=this.mutationToXML(t.children[n]);return e+="</".concat(t.tagName,">"),e}_getBlockParams(t){const e={};for(const n in t.fields)e[n]=t.fields[n].value;for(const n in t.inputs){const r=this._blocks[t.inputs[n].block];for(const t in r.fields)e[t]=r.fields[t].value}return e}_getCustomBlockInternal(t){if(t.inputs&&t.inputs.custom_block)return this._blocks[t.inputs.custom_block.block]}_addScript(t){this._scripts.indexOf(t)>-1||(this._scripts.push(t),this._blocks[t].topLevel=!0)}_deleteScript(t){const e=this._scripts.indexOf(t);e>-1&&this._scripts.splice(e,1),this._blocks[t]&&(this._blocks[t].topLevel=!1)}}u.getCached=function(t,e,n){let r=t._cache._executeCached[e];if(void 0!==r)return r;const i=t.getBlock(e);return void 0===i?null:(r=void 0===n?{id:e,opcode:t.getOpcode(i),fields:t.getFields(i),inputs:t.getInputs(i),mutation:t.getMutation(i)}:new n(t,{id:e,opcode:t.getOpcode(i),fields:t.getFields(i),inputs:t.getInputs(i),mutation:t.getMutation(i)}),t._cache._executeCached[e]=r,r)};const m=l._RuntimeScriptCache;l.getScripts=function(t,e){let n=t._cache.scripts[e];if(!n){n=t._cache.scripts[e]=[];const r=t._scripts;for(let i=0;i<r.length;i++){const s=r[i];t.getBlock(s).opcode===e&&n.push(new m(t,s))}}return n},t.exports=f},function(t,e,n){"use strict";(function(t){var r=n(97),i=n(98),s=n(99);function o(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(o()<e)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=c.prototype:(null===t&&(t=new c(e)),t.length=e),t}function c(t,e,n){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return u(this,t,e,n)}function u(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);c.TYPED_ARRAY_SUPPORT?(t=e).__proto__=c.prototype:t=d(t,e);return t}(t,e,n,r):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!c.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|f(e,n);t=a(t,r);var i=t.write(e,n);i!==r&&(t=t.slice(0,i));return t}(t,e,n):function(t,e){if(c.isBuffer(e)){var n=0|p(e.length);return 0===(t=a(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?a(t,0):d(t,e);if("Buffer"===e.type&&s(e.data))return d(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function h(t,e){if(l(e),t=a(t,e<0?0:0|p(e)),!c.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function d(t,e){var n=e.length<0?0:0|p(e.length);t=a(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function p(t){if(t>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function f(t,e){if(c.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(t).length;default:if(r)return V(t).length;e=(""+e).toLowerCase(),r=!0}}function m(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return N(this,e,n);case"utf8":case"utf-8":return S(this,e,n);case"ascii":return O(this,e,n);case"latin1":case"binary":return M(this,e,n);case"base64":return I(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function g(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function b(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=c.from(e,r)),c.isBuffer(e))return 0===e.length?-1:y(t,e,n,r,i);if("number"==typeof e)return e&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):y(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,r,i){var s,o=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;o=2,a/=2,c/=2,n/=2}function u(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i){var l=-1;for(s=n;s<a;s++)if(u(t,s)===u(e,-1===l?0:s-l)){if(-1===l&&(l=s),s-l+1===c)return l*o}else-1!==l&&(s-=s-l),l=-1}else for(n+c>a&&(n=a-c),s=n;s>=0;s--){for(var h=!0,d=0;d<c;d++)if(u(t,s+d)!==u(e,d)){h=!1;break}if(h)return s}return-1}function v(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var s=e.length;if(s%2!=0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var o=0;o<r;++o){var a=parseInt(e.substr(2*o,2),16);if(isNaN(a))return o;t[n+o]=a}return o}function w(t,e,n,r){return Y(V(e,t.length-n),t,n,r)}function T(t,e,n,r){return Y(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function E(t,e,n,r){return T(t,e,n,r)}function A(t,e,n,r){return Y(G(e),t,n,r)}function k(t,e,n,r){return Y(function(t,e){for(var n,r,i,s=[],o=0;o<t.length&&!((e-=2)<0);++o)r=(n=t.charCodeAt(o))>>8,i=n%256,s.push(i),s.push(r);return s}(e,t.length-n),t,n,r)}function I(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function S(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var s,o,a,c,u=t[i],l=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h<=n)switch(h){case 1:u<128&&(l=u);break;case 2:128==(192&(s=t[i+1]))&&(c=(31&u)<<6|63&s)>127&&(l=c);break;case 3:s=t[i+1],o=t[i+2],128==(192&s)&&128==(192&o)&&(c=(15&u)<<12|(63&s)<<6|63&o)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:s=t[i+1],o=t[i+2],a=t[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(c=(15&u)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,h=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=h}return function(t){var e=t.length;if(e<=x)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=x));return n}(r)}e.Buffer=c,e.SlowBuffer=function(t){+t!=t&&(t=0);return c.alloc(+t)},e.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=o(),c.poolSize=8192,c._augment=function(t){return t.__proto__=c.prototype,t},c.from=function(t,e,n){return u(null,t,e,n)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(t,e,n){return function(t,e,n,r){return l(e),e<=0?a(t,e):void 0!==n?"string"==typeof r?a(t,e).fill(n,r):a(t,e).fill(n):a(t,e)}(null,t,e,n)},c.allocUnsafe=function(t){return h(null,t)},c.allocUnsafeSlow=function(t){return h(null,t)},c.isBuffer=function(t){return!(null==t||!t._isBuffer)},c.compare=function(t,e){if(!c.isBuffer(t)||!c.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,s=Math.min(n,r);i<s;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},c.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(t,e){if(!s(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return c.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=c.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var o=t[n];if(!c.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},c.byteLength=f,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},c.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},c.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},c.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?S(this,0,t):m.apply(this,arguments)},c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===c.compare(this,t)},c.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},c.prototype.compare=function(t,e,n,r,i){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var s=(i>>>=0)-(r>>>=0),o=(n>>>=0)-(e>>>=0),a=Math.min(s,o),u=this.slice(r,i),l=t.slice(e,n),h=0;h<a;++h)if(u[h]!==l[h]){s=u[h],o=l[h];break}return s<o?-1:o<s?1:0},c.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},c.prototype.indexOf=function(t,e,n){return b(this,t,e,n,!0)},c.prototype.lastIndexOf=function(t,e,n){return b(this,t,e,n,!1)},c.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return v(this,t,e,n);case"utf8":case"utf-8":return w(this,t,e,n);case"ascii":return T(this,t,e,n);case"latin1":case"binary":return E(this,t,e,n);case"base64":return A(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var x=4096;function O(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function M(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function N(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",s=e;s<n;++s)i+=z(t[s]);return i}function C(t,e,n){for(var r=t.slice(e,n),i="",s=0;s<r.length;s+=2)i+=String.fromCharCode(r[s]+256*r[s+1]);return i}function R(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,n,r,i,s){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function P(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,s=Math.min(t.length-n,2);i<s;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function L(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,s=Math.min(t.length-n,4);i<s;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function B(t,e,n,r,i,s){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function U(t,e,n,r,s){return s||B(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function j(t,e,n,r,s){return s||B(t,0,n,8),i.write(t,e,n,r,52,8),n+8}c.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),c.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=c.prototype;else{var i=e-t;n=new c(i,void 0);for(var s=0;s<i;++s)n[s]=this[s+t]}return n},c.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var r=this[t],i=1,s=0;++s<e&&(i*=256);)r+=this[t+s]*i;return r},c.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},c.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]},c.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var r=this[t],i=1,s=0;++s<e&&(i*=256);)r+=this[t+s]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},c.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var r=e,i=1,s=this[t+--r];r>0&&(i*=256);)s+=this[t+--r]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*e)),s},c.prototype.readInt8=function(t,e){return e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),i.read(this,t,!1,52,8)},c.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||D(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,s=0;for(this[e]=255&t;++s<n&&(i*=256);)this[e+s]=t/i&255;return e+n},c.prototype.writeUIntBE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||D(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,s=1;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=t/s&255;return e+n},c.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,1,255,0),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},c.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},c.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},c.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):L(this,t,e,!0),e+4},c.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):L(this,t,e,!1),e+4},c.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);D(this,t,e,n,i-1,-i)}var s=0,o=1,a=0;for(this[e]=255&t;++s<n&&(o*=256);)t<0&&0===a&&0!==this[e+s-1]&&(a=1),this[e+s]=(t/o|0)-a&255;return e+n},c.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);D(this,t,e,n,i-1,-i)}var s=n-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o|0)-a&255;return e+n},c.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,1,127,-128),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},c.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},c.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):L(this,t,e,!0),e+4},c.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):L(this,t,e,!1),e+4},c.prototype.writeFloatLE=function(t,e,n){return U(this,t,e,!0,n)},c.prototype.writeFloatBE=function(t,e,n){return U(this,t,e,!1,n)},c.prototype.writeDoubleLE=function(t,e,n){return j(this,t,e,!0,n)},c.prototype.writeDoubleBE=function(t,e,n){return j(this,t,e,!1,n)},c.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,s=r-n;if(this===t&&n<e&&e<r)for(i=s-1;i>=0;--i)t[i+e]=this[i+n];else if(s<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i<s;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+s),e);return s},c.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var s;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=e;s<n;++s)this[s]=t;else{var o=c.isBuffer(t)?t:V(new c(t,r).toString()),a=o.length;for(s=0;s<n-e;++s)this[s+e]=o[s%a]}return this};var F=/[^+\/0-9A-Za-z-_]/g;function z(t){return t<16?"0"+t.toString(16):t.toString(16)}function V(t,e){var n;e=e||1/0;for(var r=t.length,i=null,s=[],o=0;o<r;++o){if((n=t.charCodeAt(o))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===r){(e-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&s.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;s.push(n)}else if(n<2048){if((e-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function G(t){return r.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(F,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Y(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}}).call(this,n(8))},function(t,e,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,s=i&&"function"==typeof i.apply?i.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function a(){a.init.call(this)}t.exports=a,t.exports.once=function(t,e){return new Promise((function(n,r){function i(n){t.removeListener(e,s),r(n)}function s(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}b(t,e,s,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&b(t,"error",e,n)}(t,i,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var c=10;function u(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function l(t){return void 0===t._maxListeners?a.defaultMaxListeners:t._maxListeners}function h(t,e,n,r){var i,s,o,a;if(u(n),void 0===(s=t._events)?(s=t._events=Object.create(null),t._eventsCount=0):(void 0!==s.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),s=t._events),o=s[e]),void 0===o)o=s[e]=n,++t._eventsCount;else if("function"==typeof o?o=s[e]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=l(t))>0&&o.length>i&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=o.length,a=c,console&&console.warn&&console.warn(a)}return t}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=d.bind(r);return i.listener=n,r.wrapFn=i,i}function f(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(i):g(i,i.length)}function m(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function g(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function b(t,e,n,r){if("function"==typeof t.on)r.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function i(s){r.once&&t.removeEventListener(e,i),n(s)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");c=t}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},a.prototype.getMaxListeners=function(){return l(this)},a.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r="error"===t,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=i[t];if(void 0===c)return!1;if("function"==typeof c)s(c,this,e);else{var u=c.length,l=g(c,u);for(n=0;n<u;++n)s(l[n],this,e)}return!0},a.prototype.addListener=function(t,e){return h(this,t,e,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(t,e){return h(this,t,e,!0)},a.prototype.once=function(t,e){return u(e),this.on(t,p(this,t,e)),this},a.prototype.prependOnceListener=function(t,e){return u(e),this.prependListener(t,p(this,t,e)),this},a.prototype.removeListener=function(t,e){var n,r,i,s,o;if(u(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(i=-1,s=n.length-1;s>=0;s--)if(n[s]===e||n[s].listener===e){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,i),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,o||e)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var i,s=Object.keys(n);for(r=0;r<s.length;++r)"removeListener"!==(i=s[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},a.prototype.listeners=function(t){return f(this,t,!0)},a.prototype.rawListeners=function(t){return f(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(t,e,n){n(103),t.exports={TextEncoder:TextEncoder,TextDecoder:TextDecoder}},function(t,e,n){(function(e,n,r,i){t.exports=function t(e,n,r){function i(o,a){if(!n[o]){if(!e[o]){if(s)return s(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[o]={exports:{}};e[o][0].call(u.exports,(function(t){return i(e[o][1][t]||t)}),u,u.exports,t,e,n,r)}return n[o].exports}for(var s=!1,o=0;o<r.length;o++)i(r[o]);return i}({1:[function(t,e,n){"use strict";var r=t("./utils"),i=t("./support"),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.encode=function(t){for(var e,n,i,o,a,c,u,l=[],h=0,d=t.length,p=d,f="string"!==r.getTypeOf(t);h<t.length;)p=d-h,i=f?(e=t[h++],n=h<d?t[h++]:0,h<d?t[h++]:0):(e=t.charCodeAt(h++),n=h<d?t.charCodeAt(h++):0,h<d?t.charCodeAt(h++):0),o=e>>2,a=(3&e)<<4|n>>4,c=1<p?(15&n)<<2|i>>6:64,u=2<p?63&i:64,l.push(s.charAt(o)+s.charAt(a)+s.charAt(c)+s.charAt(u));return l.join("")},n.decode=function(t){var e,n,r,o,a,c,u=0,l=0,h="data:";if(t.substr(0,h.length)===h)throw new Error("Invalid base64 input, it looks like a data url.");var d,p=3*(t=t.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(t.charAt(t.length-1)===s.charAt(64)&&p--,t.charAt(t.length-2)===s.charAt(64)&&p--,p%1!=0)throw new Error("Invalid base64 input, bad content length.");for(d=i.uint8array?new Uint8Array(0|p):new Array(0|p);u<t.length;)e=s.indexOf(t.charAt(u++))<<2|(o=s.indexOf(t.charAt(u++)))>>4,n=(15&o)<<4|(a=s.indexOf(t.charAt(u++)))>>2,r=(3&a)<<6|(c=s.indexOf(t.charAt(u++))),d[l++]=e,64!==a&&(d[l++]=n),64!==c&&(d[l++]=r);return d}},{"./support":30,"./utils":32}],2:[function(t,e,n){"use strict";var r=t("./external"),i=t("./stream/DataWorker"),s=t("./stream/Crc32Probe"),o=t("./stream/DataLengthProbe");function a(t,e,n,r,i){this.compressedSize=t,this.uncompressedSize=e,this.crc32=n,this.compression=r,this.compressedContent=i}a.prototype={getContentWorker:function(){var t=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),e=this;return t.on("end",(function(){if(this.streamInfo.data_length!==e.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),t},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(t,e,n){return t.pipe(new s).pipe(new o("uncompressedSize")).pipe(e.compressWorker(n)).pipe(new o("compressedSize")).withStreamInfo("compression",e)},e.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,e,n){"use strict";var r=t("./stream/GenericWorker");n.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},n.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,e,n){"use strict";var r=t("./utils"),i=function(){for(var t,e=[],n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}();e.exports=function(t,e){return void 0!==t&&t.length?"string"!==r.getTypeOf(t)?function(t,e,n,r){var s=i,o=r+n;t^=-1;for(var a=r;a<o;a++)t=t>>>8^s[255&(t^e[a])];return~t}(0|e,t,t.length,0):function(t,e,n,r){var s=i,o=r+n;t^=-1;for(var a=r;a<o;a++)t=t>>>8^s[255&(t^e.charCodeAt(a))];return~t}(0|e,t,t.length,0):0}},{"./utils":32}],5:[function(t,e,n){"use strict";n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(t,e,n){"use strict";var r=null;r="undefined"!=typeof Promise?Promise:t("lie"),e.exports={Promise:r}},{lie:37}],7:[function(t,e,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=t("pako"),s=t("./utils"),o=t("./stream/GenericWorker"),a=r?"uint8array":"array";function c(t,e){o.call(this,"FlateWorker/"+t),this._pako=null,this._pakoAction=t,this._pakoOptions=e,this.meta={}}n.magic="\b\0",s.inherits(c,o),c.prototype.processChunk=function(t){this.meta=t.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(a,t.data),!1)},c.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new i[this._pakoAction]({chunkSize:65536,raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},n.compressWorker=function(t){return new c("Deflate",t)},n.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,e,n){"use strict";function r(t,e){var n,r="";for(n=0;n<e;n++)r+=String.fromCharCode(255&t),t>>>=8;return r}function i(t,e,n,i,o,l){var h,d,p=t.file,f=t.compression,m=l!==a.utf8encode,g=s.transformTo("string",l(p.name)),b=s.transformTo("string",a.utf8encode(p.name)),y=p.comment,v=s.transformTo("string",l(y)),w=s.transformTo("string",a.utf8encode(y)),T=b.length!==p.name.length,E=w.length!==y.length,A="",k="",I="",S=p.dir,x=p.date,O={crc32:0,compressedSize:0,uncompressedSize:0};e&&!n||(O.crc32=t.crc32,O.compressedSize=t.compressedSize,O.uncompressedSize=t.uncompressedSize);var M=0;e&&(M|=8),m||!T&&!E||(M|=2048);var N=0,C=0;S&&(N|=16),"UNIX"===o?(C=798,N|=function(t,e){var n=t;return t||(n=e?16893:33204),(65535&n)<<16}(p.unixPermissions,S)):(C=20,N|=function(t){return 63&(t||0)}(p.dosPermissions)),h=x.getUTCHours(),h<<=6,h|=x.getUTCMinutes(),h<<=5,h|=x.getUTCSeconds()/2,d=x.getUTCFullYear()-1980,d<<=4,d|=x.getUTCMonth()+1,d<<=5,d|=x.getUTCDate(),T&&(k=r(1,1)+r(c(g),4)+b,A+="up"+r(k.length,2)+k),E&&(I=r(1,1)+r(c(v),4)+w,A+="uc"+r(I.length,2)+I);var R="";return R+="\n\0",R+=r(M,2),R+=f.magic,R+=r(h,2),R+=r(d,2),R+=r(O.crc32,4),R+=r(O.compressedSize,4),R+=r(O.uncompressedSize,4),R+=r(g.length,2),R+=r(A.length,2),{fileRecord:u.LOCAL_FILE_HEADER+R+g+A,dirRecord:u.CENTRAL_FILE_HEADER+r(C,2)+R+r(v.length,2)+"\0\0\0\0"+r(N,4)+r(i,4)+g+A+v}}var s=t("../utils"),o=t("../stream/GenericWorker"),a=t("../utf8"),c=t("../crc32"),u=t("../signature");function l(t,e,n,r){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=e,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=t,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(l,o),l.prototype.push=function(t){var e=t.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(t):(this.bytesWritten+=t.data.length,o.prototype.push.call(this,{data:t.data,meta:{currentFile:this.currentFile,percent:n?(e+100*(n-r-1))/n:100}}))},l.prototype.openedSource=function(t){this.currentSourceOffset=this.bytesWritten,this.currentFile=t.file.name;var e=this.streamFiles&&!t.file.dir;if(e){var n=i(t,e,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},l.prototype.closedSource=function(t){this.accumulate=!1;var e=this.streamFiles&&!t.file.dir,n=i(t,e,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),e)this.push({data:function(t){return u.DATA_DESCRIPTOR+r(t.crc32,4)+r(t.compressedSize,4)+r(t.uncompressedSize,4)}(t),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},l.prototype.flush=function(){for(var t=this.bytesWritten,e=0;e<this.dirRecords.length;e++)this.push({data:this.dirRecords[e],meta:{percent:100}});var n=this.bytesWritten-t,i=function(t,e,n,i,o){var a=s.transformTo("string",o(i));return u.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(t,2)+r(t,2)+r(e,4)+r(n,4)+r(a.length,2)+a}(this.dirRecords.length,n,t,this.zipComment,this.encodeFileName);this.push({data:i,meta:{percent:100}})},l.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},l.prototype.registerPrevious=function(t){this._sources.push(t);var e=this;return t.on("data",(function(t){e.processChunk(t)})),t.on("end",(function(){e.closedSource(e.previous.streamInfo),e._sources.length?e.prepareNextSource():e.end()})),t.on("error",(function(t){e.error(t)})),this},l.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},l.prototype.error=function(t){var e=this._sources;if(!o.prototype.error.call(this,t))return!1;for(var n=0;n<e.length;n++)try{e[n].error(t)}catch(t){}return!0},l.prototype.lock=function(){o.prototype.lock.call(this);for(var t=this._sources,e=0;e<t.length;e++)t[e].lock()},e.exports=l},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,e,n){"use strict";var r=t("../compressions"),i=t("./ZipFileWorker");n.generateWorker=function(t,e,n){var s=new i(e.streamFiles,n,e.platform,e.encodeFileName),o=0;try{t.forEach((function(t,n){o++;var i=function(t,e){var n=t||e,i=r[n];if(!i)throw new Error(n+" is not a valid compression method !");return i}(n.options.compression,e.compression),a=n.options.compressionOptions||e.compressionOptions||{},c=n.dir,u=n.date;n._compressWorker(i,a).withStreamInfo("file",{name:t,dir:c,date:u,comment:n.comment||"",unixPermissions:n.unixPermissions,dosPermissions:n.dosPermissions}).pipe(s)})),s.entriesCount=o}catch(t){s.error(t)}return s}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,e,n){"use strict";function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var t=new r;for(var e in this)"function"!=typeof this[e]&&(t[e]=this[e]);return t}}(r.prototype=t("./object")).loadAsync=t("./load"),r.support=t("./support"),r.defaults=t("./defaults"),r.version="3.10.1",r.loadAsync=function(t,e){return(new r).loadAsync(t,e)},r.external=t("./external"),e.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,e,n){"use strict";var r=t("./utils"),i=t("./external"),s=t("./utf8"),o=t("./zipEntries"),a=t("./stream/Crc32Probe"),c=t("./nodejsUtils");function u(t){return new i.Promise((function(e,n){var r=t.decompressed.getContentWorker().pipe(new a);r.on("error",(function(t){n(t)})).on("end",(function(){r.streamInfo.crc32!==t.decompressed.crc32?n(new Error("Corrupted zip : CRC32 mismatch")):e()})).resume()}))}e.exports=function(t,e){var n=this;return e=r.extend(e||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:s.utf8decode}),c.isNode&&c.isStream(t)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",t,!0,e.optimizedBinaryString,e.base64).then((function(t){var n=new o(e);return n.load(t),n})).then((function(t){var n=[i.Promise.resolve(t)],r=t.files;if(e.checkCRC32)for(var s=0;s<r.length;s++)n.push(u(r[s]));return i.Promise.all(n)})).then((function(t){for(var i=t.shift(),s=i.files,o=0;o<s.length;o++){var a=s[o],c=a.fileNameStr,u=r.resolve(a.fileNameStr);n.file(u,a.decompressed,{binary:!0,optimizedBinaryString:!0,date:a.date,dir:a.dir,comment:a.fileCommentStr.length?a.fileCommentStr:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:e.createFolders}),a.dir||(n.file(u).unsafeOriginalName=c)}return i.zipComment.length&&(n.comment=i.zipComment),n}))}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,e,n){"use strict";var r=t("../utils"),i=t("../stream/GenericWorker");function s(t,e){i.call(this,"Nodejs stream input adapter for "+t),this._upstreamEnded=!1,this._bindStream(e)}r.inherits(s,i),s.prototype._bindStream=function(t){var e=this;(this._stream=t).pause(),t.on("data",(function(t){e.push({data:t,meta:{percent:0}})})).on("error",(function(t){e.isPaused?this.generatedError=t:e.error(t)})).on("end",(function(){e.isPaused?e._upstreamEnded=!0:e.end()}))},s.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},e.exports=s},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,e,n){"use strict";var r=t("readable-stream").Readable;function i(t,e,n){r.call(this,e),this._helper=t;var i=this;t.on("data",(function(t,e){i.push(t)||i._helper.pause(),n&&n(e)})).on("error",(function(t){i.emit("error",t)})).on("end",(function(){i.push(null)}))}t("../utils").inherits(i,r),i.prototype._read=function(){this._helper.resume()},e.exports=i},{"../utils":32,"readable-stream":16}],14:[function(t,n,r){"use strict";n.exports={isNode:void 0!==e,newBufferFrom:function(t,n){if(e.from&&e.from!==Uint8Array.from)return e.from(t,n);if("number"==typeof t)throw new Error('The "data" argument must not be a number');return new e(t,n)},allocBuffer:function(t){if(e.alloc)return e.alloc(t);var n=new e(t);return n.fill(0),n},isBuffer:function(t){return e.isBuffer(t)},isStream:function(t){return t&&"function"==typeof t.on&&"function"==typeof t.pause&&"function"==typeof t.resume}}},{}],15:[function(t,e,n){"use strict";function r(t,e,n){var r,i=s.getTypeOf(e),a=s.extend(n||{},c);a.date=a.date||new Date,null!==a.compression&&(a.compression=a.compression.toUpperCase()),"string"==typeof a.unixPermissions&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&16384&a.unixPermissions&&(a.dir=!0),a.dosPermissions&&16&a.dosPermissions&&(a.dir=!0),a.dir&&(t=m(t)),a.createFolders&&(r=f(t))&&g.call(this,r,!0);var h="string"===i&&!1===a.binary&&!1===a.base64;n&&void 0!==n.binary||(a.binary=!h),(e instanceof u&&0===e.uncompressedSize||a.dir||!e||0===e.length)&&(a.base64=!1,a.binary=!0,e="",a.compression="STORE",i="string");var b=null;b=e instanceof u||e instanceof o?e:d.isNode&&d.isStream(e)?new p(t,e):s.prepareContent(t,e,a.binary,a.optimizedBinaryString,a.base64);var y=new l(t,b,a);this.files[t]=y}var i=t("./utf8"),s=t("./utils"),o=t("./stream/GenericWorker"),a=t("./stream/StreamHelper"),c=t("./defaults"),u=t("./compressedObject"),l=t("./zipObject"),h=t("./generate"),d=t("./nodejsUtils"),p=t("./nodejs/NodejsStreamInputAdapter"),f=function(t){"/"===t.slice(-1)&&(t=t.substring(0,t.length-1));var e=t.lastIndexOf("/");return 0<e?t.substring(0,e):""},m=function(t){return"/"!==t.slice(-1)&&(t+="/"),t},g=function(t,e){return e=void 0!==e?e:c.createFolders,t=m(t),this.files[t]||r.call(this,t,null,{dir:!0,createFolders:e}),this.files[t]};function b(t){return"[object RegExp]"===Object.prototype.toString.call(t)}var y={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(t){var e,n,r;for(e in this.files)r=this.files[e],(n=e.slice(this.root.length,e.length))&&e.slice(0,this.root.length)===this.root&&t(n,r)},filter:function(t){var e=[];return this.forEach((function(n,r){t(n,r)&&e.push(r)})),e},file:function(t,e,n){if(1!==arguments.length)return t=this.root+t,r.call(this,t,e,n),this;if(b(t)){var i=t;return this.filter((function(t,e){return!e.dir&&i.test(t)}))}var s=this.files[this.root+t];return s&&!s.dir?s:null},folder:function(t){if(!t)return this;if(b(t))return this.filter((function(e,n){return n.dir&&t.test(e)}));var e=this.root+t,n=g.call(this,e),r=this.clone();return r.root=n.name,r},remove:function(t){t=this.root+t;var e=this.files[t];if(e||("/"!==t.slice(-1)&&(t+="/"),e=this.files[t]),e&&!e.dir)delete this.files[t];else for(var n=this.filter((function(e,n){return n.name.slice(0,t.length)===t})),r=0;r<n.length;r++)delete this.files[n[r].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(t){var e,n={};try{if((n=s.extend(t||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=n.type.toLowerCase(),n.compression=n.compression.toUpperCase(),"binarystring"===n.type&&(n.type="string"),!n.type)throw new Error("No output type specified.");s.checkSupport(n.type),"darwin"!==n.platform&&"freebsd"!==n.platform&&"linux"!==n.platform&&"sunos"!==n.platform||(n.platform="UNIX"),"win32"===n.platform&&(n.platform="DOS");var r=n.comment||this.comment||"";e=h.generateWorker(this,n,r)}catch(t){(e=new o("error")).error(t)}return new a(e,n.type||"string",n.mimeType)},generateAsync:function(t,e){return this.generateInternalStream(t).accumulate(e)},generateNodeStream:function(t,e){return(t=t||{}).type||(t.type="nodebuffer"),this.generateInternalStream(t).toNodejsStream(e)}};e.exports=y},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(t,e,n){"use strict";e.exports=t("stream")},{stream:void 0}],17:[function(t,e,n){"use strict";var r=t("./DataReader");function i(t){r.call(this,t);for(var e=0;e<this.data.length;e++)t[e]=255&t[e]}t("../utils").inherits(i,r),i.prototype.byteAt=function(t){return this.data[this.zero+t]},i.prototype.lastIndexOfSignature=function(t){for(var e=t.charCodeAt(0),n=t.charCodeAt(1),r=t.charCodeAt(2),i=t.charCodeAt(3),s=this.length-4;0<=s;--s)if(this.data[s]===e&&this.data[s+1]===n&&this.data[s+2]===r&&this.data[s+3]===i)return s-this.zero;return-1},i.prototype.readAndCheckSignature=function(t){var e=t.charCodeAt(0),n=t.charCodeAt(1),r=t.charCodeAt(2),i=t.charCodeAt(3),s=this.readData(4);return e===s[0]&&n===s[1]&&r===s[2]&&i===s[3]},i.prototype.readData=function(t){if(this.checkOffset(t),0===t)return[];var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=i},{"../utils":32,"./DataReader":18}],18:[function(t,e,n){"use strict";var r=t("../utils");function i(t){this.data=t,this.length=t.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(t){this.checkIndex(this.index+t)},checkIndex:function(t){if(this.length<this.zero+t||t<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+t+"). Corrupted zip ?")},setIndex:function(t){this.checkIndex(t),this.index=t},skip:function(t){this.setIndex(this.index+t)},byteAt:function(){},readInt:function(t){var e,n=0;for(this.checkOffset(t),e=this.index+t-1;e>=this.index;e--)n=(n<<8)+this.byteAt(e);return this.index+=t,n},readString:function(t){return r.transformTo("string",this.readData(t))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var t=this.readInt(4);return new Date(Date.UTC(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1))}},e.exports=i},{"../utils":32}],19:[function(t,e,n){"use strict";var r=t("./Uint8ArrayReader");function i(t){r.call(this,t)}t("../utils").inherits(i,r),i.prototype.readData=function(t){this.checkOffset(t);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,e,n){"use strict";var r=t("./DataReader");function i(t){r.call(this,t)}t("../utils").inherits(i,r),i.prototype.byteAt=function(t){return this.data.charCodeAt(this.zero+t)},i.prototype.lastIndexOfSignature=function(t){return this.data.lastIndexOf(t)-this.zero},i.prototype.readAndCheckSignature=function(t){return t===this.readData(4)},i.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=i},{"../utils":32,"./DataReader":18}],21:[function(t,e,n){"use strict";var r=t("./ArrayReader"),i=t("./DataReader");function s(t){i.call(this,t)}t("../utils").inherits(s,r),s.prototype.readData=function(t){if(this.checkOffset(t),0===t)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=s},{"../utils":32,"./ArrayReader":17,"./DataReader":18}],22:[function(t,e,n){"use strict";var r=t("../utils"),i=t("../support"),s=t("./ArrayReader"),o=t("./StringReader"),a=t("./NodeBufferReader"),c=t("./Uint8ArrayReader");e.exports=function(t){var e=r.getTypeOf(t);return r.checkSupport(e),"string"!==e||i.uint8array?"nodebuffer"===e?new a(t):i.uint8array?new c(r.transformTo("uint8array",t)):new s(r.transformTo("array",t)):new o(t)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,e,n){"use strict";n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\b"},{}],24:[function(t,e,n){"use strict";var r=t("./GenericWorker"),i=t("../utils");function s(t){r.call(this,"ConvertWorker to "+t),this.destType=t}i.inherits(s,r),s.prototype.processChunk=function(t){this.push({data:i.transformTo(this.destType,t.data),meta:t.meta})},e.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(t,e,n){"use strict";var r=t("./GenericWorker"),i=t("../crc32");function s(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(s,r),s.prototype.processChunk=function(t){this.streamInfo.crc32=i(t.data,this.streamInfo.crc32||0),this.push(t)},e.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,e,n){"use strict";var r=t("../utils"),i=t("./GenericWorker");function s(t){i.call(this,"DataLengthProbe for "+t),this.propName=t,this.withStreamInfo(t,0)}r.inherits(s,i),s.prototype.processChunk=function(t){if(t){var e=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=e+t.data.length}i.prototype.processChunk.call(this,t)},e.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(t,e,n){"use strict";var r=t("../utils"),i=t("./GenericWorker");function s(t){i.call(this,"DataWorker");var e=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,t.then((function(t){e.dataIsReady=!0,e.data=t,e.max=t&&t.length||0,e.type=r.getTypeOf(t),e.isPaused||e._tickAndRepeat()}),(function(t){e.error(t)}))}r.inherits(s,i),s.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var t=null,e=Math.min(this.max,this.index+65536);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,e);break;case"uint8array":case"nodebuffer":t=this.data.subarray(this.index,e);break;case"array":t=this.data.slice(this.index,e)}return this.index=e,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})},e.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(t,e,n){"use strict";function r(t){this.name=t||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(t){this.emit("data",t)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(t){this.emit("error",t)}return!0},error:function(t){return!this.isFinished&&(this.isPaused?this.generatedError=t:(this.isFinished=!0,this.emit("error",t),this.previous&&this.previous.error(t),this.cleanUp()),!0)},on:function(t,e){return this._listeners[t].push(e),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(t,e){if(this._listeners[t])for(var n=0;n<this._listeners[t].length;n++)this._listeners[t][n].call(this,e)},pipe:function(t){return t.registerPrevious(this)},registerPrevious:function(t){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=t.streamInfo,this.mergeStreamInfo(),this.previous=t;var e=this;return t.on("data",(function(t){e.processChunk(t)})),t.on("end",(function(){e.end()})),t.on("error",(function(t){e.error(t)})),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var t=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),t=!0),this.previous&&this.previous.resume(),!t},flush:function(){},processChunk:function(t){this.push(t)},withStreamInfo:function(t,e){return this.extraStreamInfo[t]=e,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var t in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,t)&&(this.streamInfo[t]=this.extraStreamInfo[t])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var t="Worker "+this.name;return this.previous?this.previous+" -> "+t:t}},e.exports=r},{}],29:[function(t,n,r){"use strict";var i=t("../utils"),s=t("./ConvertWorker"),o=t("./GenericWorker"),a=t("../base64"),c=t("../support"),u=t("../external"),l=null;if(c.nodestream)try{l=t("../nodejs/NodejsStreamOutputAdapter")}catch(t){}function h(t,n){return new u.Promise((function(r,s){var o=[],c=t._internalType,u=t._outputType,l=t._mimeType;t.on("data",(function(t,e){o.push(t),n&&n(e)})).on("error",(function(t){o=[],s(t)})).on("end",(function(){try{var t=function(t,e,n){switch(t){case"blob":return i.newBlob(i.transformTo("arraybuffer",e),n);case"base64":return a.encode(e);default:return i.transformTo(t,e)}}(u,function(t,n){var r,i=0,s=null,o=0;for(r=0;r<n.length;r++)o+=n[r].length;switch(t){case"string":return n.join("");case"array":return Array.prototype.concat.apply([],n);case"uint8array":for(s=new Uint8Array(o),r=0;r<n.length;r++)s.set(n[r],i),i+=n[r].length;return s;case"nodebuffer":return e.concat(n);default:throw new Error("concat : unsupported type '"+t+"'")}}(c,o),l);r(t)}catch(t){s(t)}o=[]})).resume()}))}function d(t,e,n){var r=e;switch(e){case"blob":case"arraybuffer":r="uint8array";break;case"base64":r="string"}try{this._internalType=r,this._outputType=e,this._mimeType=n,i.checkSupport(r),this._worker=t.pipe(new s(r)),t.lock()}catch(t){this._worker=new o("error"),this._worker.error(t)}}d.prototype={accumulate:function(t){return h(this,t)},on:function(t,e){var n=this;return"data"===t?this._worker.on(t,(function(t){e.call(n,t.data,t.meta)})):this._worker.on(t,(function(){i.delay(e,arguments,n)})),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(t){if(i.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new l(this,{objectMode:"nodebuffer"!==this._outputType},t)}},n.exports=d},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,n,r){"use strict";if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,r.nodebuffer=void 0!==e,r.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)r.blob=!1;else{var i=new ArrayBuffer(0);try{r.blob=0===new Blob([i],{type:"application/zip"}).size}catch(t){try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),r.blob=0===s.getBlob("application/zip").size}catch(t){r.blob=!1}}}try{r.nodestream=!!t("readable-stream").Readable}catch(t){r.nodestream=!1}},{"readable-stream":16}],31:[function(t,e,n){"use strict";for(var r=t("./utils"),i=t("./support"),s=t("./nodejsUtils"),o=t("./stream/GenericWorker"),a=new Array(256),c=0;c<256;c++)a[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function u(){o.call(this,"utf-8 decode"),this.leftOver=null}function l(){o.call(this,"utf-8 encode")}a[254]=a[254]=1,n.utf8encode=function(t){return i.nodebuffer?s.newBufferFrom(t,"utf-8"):function(t){var e,n,r,s,o,a=t.length,c=0;for(s=0;s<a;s++)55296==(64512&(n=t.charCodeAt(s)))&&s+1<a&&56320==(64512&(r=t.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(r-56320),s++),c+=n<128?1:n<2048?2:n<65536?3:4;for(e=i.uint8array?new Uint8Array(c):new Array(c),s=o=0;o<c;s++)55296==(64512&(n=t.charCodeAt(s)))&&s+1<a&&56320==(64512&(r=t.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(r-56320),s++),n<128?e[o++]=n:(n<2048?e[o++]=192|n>>>6:(n<65536?e[o++]=224|n>>>12:(e[o++]=240|n>>>18,e[o++]=128|n>>>12&63),e[o++]=128|n>>>6&63),e[o++]=128|63&n);return e}(t)},n.utf8decode=function(t){return i.nodebuffer?r.transformTo("nodebuffer",t).toString("utf-8"):function(t){var e,n,i,s,o=t.length,c=new Array(2*o);for(e=n=0;e<o;)if((i=t[e++])<128)c[n++]=i;else if(4<(s=a[i]))c[n++]=65533,e+=s-1;else{for(i&=2===s?31:3===s?15:7;1<s&&e<o;)i=i<<6|63&t[e++],s--;1<s?c[n++]=65533:i<65536?c[n++]=i:(i-=65536,c[n++]=55296|i>>10&1023,c[n++]=56320|1023&i)}return c.length!==n&&(c.subarray?c=c.subarray(0,n):c.length=n),r.applyFromCharCode(c)}(t=r.transformTo(i.uint8array?"uint8array":"array",t))},r.inherits(u,o),u.prototype.processChunk=function(t){var e=r.transformTo(i.uint8array?"uint8array":"array",t.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var s=e;(e=new Uint8Array(s.length+this.leftOver.length)).set(this.leftOver,0),e.set(s,this.leftOver.length)}else e=this.leftOver.concat(e);this.leftOver=null}var o=function(t,e){var n;for((e=e||t.length)>t.length&&(e=t.length),n=e-1;0<=n&&128==(192&t[n]);)n--;return n<0||0===n?e:n+a[t[n]]>e?n:e}(e),c=e;o!==e.length&&(i.uint8array?(c=e.subarray(0,o),this.leftOver=e.subarray(o,e.length)):(c=e.slice(0,o),this.leftOver=e.slice(o,e.length))),this.push({data:n.utf8decode(c),meta:t.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=u,r.inherits(l,o),l.prototype.processChunk=function(t){this.push({data:n.utf8encode(t.data),meta:t.meta})},n.Utf8EncodeWorker=l},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,e,r){"use strict";var i=t("./support"),s=t("./base64"),o=t("./nodejsUtils"),a=t("./external");function c(t){return t}function u(t,e){for(var n=0;n<t.length;++n)e[n]=255&t.charCodeAt(n);return e}t("setimmediate"),r.newBlob=function(t,e){r.checkSupport("blob");try{return new Blob([t],{type:e})}catch(r){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return n.append(t),n.getBlob(e)}catch(t){throw new Error("Bug : can't construct the Blob.")}}};var l={stringifyByChunk:function(t,e,n){var r=[],i=0,s=t.length;if(s<=n)return String.fromCharCode.apply(null,t);for(;i<s;)"array"===e||"nodebuffer"===e?r.push(String.fromCharCode.apply(null,t.slice(i,Math.min(i+n,s)))):r.push(String.fromCharCode.apply(null,t.subarray(i,Math.min(i+n,s)))),i+=n;return r.join("")},stringifyByChar:function(t){for(var e="",n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(t){return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&1===String.fromCharCode.apply(null,o.allocBuffer(1)).length}catch(t){return!1}}()}};function h(t){var e=65536,n=r.getTypeOf(t),i=!0;if("uint8array"===n?i=l.applyCanBeUsed.uint8array:"nodebuffer"===n&&(i=l.applyCanBeUsed.nodebuffer),i)for(;1<e;)try{return l.stringifyByChunk(t,n,e)}catch(t){e=Math.floor(e/2)}return l.stringifyByChar(t)}function d(t,e){for(var n=0;n<t.length;n++)e[n]=t[n];return e}r.applyFromCharCode=h;var p={};p.string={string:c,array:function(t){return u(t,new Array(t.length))},arraybuffer:function(t){return p.string.uint8array(t).buffer},uint8array:function(t){return u(t,new Uint8Array(t.length))},nodebuffer:function(t){return u(t,o.allocBuffer(t.length))}},p.array={string:h,array:c,arraybuffer:function(t){return new Uint8Array(t).buffer},uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return o.newBufferFrom(t)}},p.arraybuffer={string:function(t){return h(new Uint8Array(t))},array:function(t){return d(new Uint8Array(t),new Array(t.byteLength))},arraybuffer:c,uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return o.newBufferFrom(new Uint8Array(t))}},p.uint8array={string:h,array:function(t){return d(t,new Array(t.length))},arraybuffer:function(t){return t.buffer},uint8array:c,nodebuffer:function(t){return o.newBufferFrom(t)}},p.nodebuffer={string:h,array:function(t){return d(t,new Array(t.length))},arraybuffer:function(t){return t.buffer},uint8array:function(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)},nodebuffer:c},r.transformTo=function(t,e){if(e=e||"",!t)return e;r.checkSupport(t);var n=r.getTypeOf(e);return p[n][t](e)},r.resolve=function(t){for(var e=t.split("/"),n=[],r=0;r<e.length;r++){var i=e[r];"."===i||""===i&&0!==r&&r!==e.length-1||(".."===i?n.pop():n.push(i))}return n.join("/")},r.getTypeOf=function(t){return"string"==typeof t?"string":"[object Array]"===Object.prototype.toString.call(t)?"array":i.nodebuffer&&o.isBuffer(t)?"nodebuffer":i.uint8array&&t instanceof Uint8Array?"uint8array":i.arraybuffer&&t instanceof ArrayBuffer?"arraybuffer":void 0},r.checkSupport=function(t){if(!i[t.toLowerCase()])throw new Error(t+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(t){var e,n,r="";for(n=0;n<(t||"").length;n++)r+="\\x"+((e=t.charCodeAt(n))<16?"0":"")+e.toString(16).toUpperCase();return r},r.delay=function(t,e,r){n((function(){t.apply(r||null,e||[])}))},r.inherits=function(t,e){function n(){}n.prototype=e.prototype,t.prototype=new n},r.extend=function(){var t,e,n={};for(t=0;t<arguments.length;t++)for(e in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],e)&&void 0===n[e]&&(n[e]=arguments[t][e]);return n},r.prepareContent=function(t,e,n,o,c){return a.Promise.resolve(e).then((function(t){var e=i.blob&&(t instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(t)));return e&&"undefined"!=typeof FileReader?new a.Promise((function(e,n){var r=new FileReader;r.onload=function(t){e(t.target.result)},r.onerror=function(t){n(t.target.error)},r.readAsArrayBuffer(t)})):e&&"function"==typeof t.arrayBuffer?t.arrayBuffer():t})).then((function(e){var l=r.getTypeOf(e);return l?("arraybuffer"===l?e=r.transformTo("uint8array",e):"string"===l&&(c?e=s.decode(e):n&&!0!==o&&(e=function(t){return u(t,i.uint8array?new Uint8Array(t.length):new Array(t.length))}(e))),e):a.Promise.reject(new Error("Can't read the data of '"+t+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))}))}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,e,n){"use strict";var r=t("./reader/readerFor"),i=t("./utils"),s=t("./signature"),o=t("./zipEntry"),a=t("./support");function c(t){this.files=[],this.loadOptions=t}c.prototype={checkSignature:function(t){if(!this.reader.readAndCheckSignature(t)){this.reader.index-=4;var e=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(e)+", expected "+i.pretty(t)+")")}},isSignature:function(t,e){var n=this.reader.index;this.reader.setIndex(t);var r=this.reader.readString(4)===e;return this.reader.setIndex(n),r},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var t=this.reader.readData(this.zipCommentLength),e=a.uint8array?"uint8array":"array",n=i.transformTo(e,t);this.zipComment=this.loadOptions.decodeFileName(n)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var t,e,n,r=this.zip64EndOfCentralSize-44;0<r;)t=this.reader.readInt(2),e=this.reader.readInt(4),n=this.reader.readData(e),this.zip64ExtensibleData[t]={id:t,length:e,value:n}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var t,e;for(t=0;t<this.files.length;t++)e=this.files[t],this.reader.setIndex(e.localHeaderOffset),this.checkSignature(s.LOCAL_FILE_HEADER),e.readLocalPart(this.reader),e.handleUTF8(),e.processAttributes()},readCentralDir:function(){var t;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER);)(t=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(t);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var t=this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);if(t<0)throw this.isSignature(0,s.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(t);var e=t;if(this.checkSignature(s.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(t=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(t),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,s.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var n=this.centralDirOffset+this.centralDirSize;this.zip64&&(n+=20,n+=12+this.zip64EndOfCentralSize);var r=e-n;if(0<r)this.isSignature(e,s.CENTRAL_FILE_HEADER)||(this.reader.zero=r);else if(r<0)throw new Error("Corrupted zip: missing "+Math.abs(r)+" bytes.")},prepareReader:function(t){this.reader=r(t)},load:function(t){this.prepareReader(t),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},e.exports=c},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,e,n){"use strict";var r=t("./reader/readerFor"),i=t("./utils"),s=t("./compressedObject"),o=t("./crc32"),a=t("./utf8"),c=t("./compressions"),u=t("./support");function l(t,e){this.options=t,this.loadOptions=e}l.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(t){var e,n;if(t.skip(22),this.fileNameLength=t.readInt(2),n=t.readInt(2),this.fileName=t.readData(this.fileNameLength),t.skip(n),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(e=function(t){for(var e in c)if(Object.prototype.hasOwnProperty.call(c,e)&&c[e].magic===t)return c[e];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new s(this.compressedSize,this.uncompressedSize,this.crc32,e,t.readData(this.compressedSize))},readCentralPart:function(t){this.versionMadeBy=t.readInt(2),t.skip(2),this.bitFlag=t.readInt(2),this.compressionMethod=t.readString(2),this.date=t.readDate(),this.crc32=t.readInt(4),this.compressedSize=t.readInt(4),this.uncompressedSize=t.readInt(4);var e=t.readInt(2);if(this.extraFieldsLength=t.readInt(2),this.fileCommentLength=t.readInt(2),this.diskNumberStart=t.readInt(2),this.internalFileAttributes=t.readInt(2),this.externalFileAttributes=t.readInt(4),this.localHeaderOffset=t.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");t.skip(e),this.readExtraFields(t),this.parseZIP64ExtraField(t),this.fileComment=t.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var t=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==t&&(this.dosPermissions=63&this.externalFileAttributes),3==t&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var t=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=t.readInt(4))}},readExtraFields:function(t){var e,n,r,i=t.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});t.index+4<i;)e=t.readInt(2),n=t.readInt(2),r=t.readData(n),this.extraFields[e]={id:e,length:n,value:r};t.setIndex(i)},handleUTF8:function(){var t=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var e=this.findExtraFieldUnicodePath();if(null!==e)this.fileNameStr=e;else{var n=i.transformTo(t,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(n)}var r=this.findExtraFieldUnicodeComment();if(null!==r)this.fileCommentStr=r;else{var s=i.transformTo(t,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(s)}}},findExtraFieldUnicodePath:function(){var t=this.extraFields[28789];if(t){var e=r(t.value);return 1!==e.readInt(1)||o(this.fileName)!==e.readInt(4)?null:a.utf8decode(e.readData(t.length-5))}return null},findExtraFieldUnicodeComment:function(){var t=this.extraFields[25461];if(t){var e=r(t.value);return 1!==e.readInt(1)||o(this.fileComment)!==e.readInt(4)?null:a.utf8decode(e.readData(t.length-5))}return null}},e.exports=l},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,e,n){"use strict";function r(t,e,n){this.name=t,this.dir=n.dir,this.date=n.date,this.comment=n.comment,this.unixPermissions=n.unixPermissions,this.dosPermissions=n.dosPermissions,this._data=e,this._dataBinary=n.binary,this.options={compression:n.compression,compressionOptions:n.compressionOptions}}var i=t("./stream/StreamHelper"),s=t("./stream/DataWorker"),o=t("./utf8"),a=t("./compressedObject"),c=t("./stream/GenericWorker");r.prototype={internalStream:function(t){var e=null,n="string";try{if(!t)throw new Error("No output type specified.");var r="string"===(n=t.toLowerCase())||"text"===n;"binarystring"!==n&&"text"!==n||(n="string"),e=this._decompressWorker();var s=!this._dataBinary;s&&!r&&(e=e.pipe(new o.Utf8EncodeWorker)),!s&&r&&(e=e.pipe(new o.Utf8DecodeWorker))}catch(t){(e=new c("error")).error(t)}return new i(e,n,"")},async:function(t,e){return this.internalStream(t).accumulate(e)},nodeStream:function(t,e){return this.internalStream(t||"nodebuffer").toNodejsStream(e)},_compressWorker:function(t,e){if(this._data instanceof a&&this._data.compression.magic===t.magic)return this._data.getCompressedWorker();var n=this._decompressWorker();return this._dataBinary||(n=n.pipe(new o.Utf8EncodeWorker)),a.createWorkerFrom(n,t,e)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof c?this._data:new s(this._data)}};for(var u=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],l=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},h=0;h<u.length;h++)r.prototype[u[h]]=l;e.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,e,n){(function(t){"use strict";var n,r,i=t.MutationObserver||t.WebKitMutationObserver;if(i){var s=0,o=new i(l),a=t.document.createTextNode("");o.observe(a,{characterData:!0}),n=function(){a.data=s=++s%2}}else if(t.setImmediate||void 0===t.MessageChannel)n="document"in t&&"onreadystatechange"in t.document.createElement("script")?function(){var e=t.document.createElement("script");e.onreadystatechange=function(){l(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},t.document.documentElement.appendChild(e)}:function(){setTimeout(l,0)};else{var c=new t.MessageChannel;c.port1.onmessage=l,n=function(){c.port2.postMessage(0)}}var u=[];function l(){var t,e;r=!0;for(var n=u.length;n;){for(e=u,u=[],t=-1;++t<n;)e[t]();n=u.length}r=!1}e.exports=function(t){1!==u.push(t)||r||n()}}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(t,e,n){"use strict";var r=t("immediate");function i(){}var s={},o=["REJECTED"],a=["FULFILLED"],c=["PENDING"];function u(t){if("function"!=typeof t)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,t!==i&&p(this,t)}function l(t,e,n){this.promise=t,"function"==typeof e&&(this.onFulfilled=e,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function h(t,e,n){r((function(){var r;try{r=e(n)}catch(r){return s.reject(t,r)}r===t?s.reject(t,new TypeError("Cannot resolve promise with itself")):s.resolve(t,r)}))}function d(t){var e=t&&t.then;if(t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof e)return function(){e.apply(t,arguments)}}function p(t,e){var n=!1;function r(e){n||(n=!0,s.reject(t,e))}function i(e){n||(n=!0,s.resolve(t,e))}var o=f((function(){e(i,r)}));"error"===o.status&&r(o.value)}function f(t,e){var n={};try{n.value=t(e),n.status="success"}catch(t){n.status="error",n.value=t}return n}(e.exports=u).prototype.finally=function(t){if("function"!=typeof t)return this;var e=this.constructor;return this.then((function(n){return e.resolve(t()).then((function(){return n}))}),(function(n){return e.resolve(t()).then((function(){throw n}))}))},u.prototype.catch=function(t){return this.then(null,t)},u.prototype.then=function(t,e){if("function"!=typeof t&&this.state===a||"function"!=typeof e&&this.state===o)return this;var n=new this.constructor(i);return this.state!==c?h(n,this.state===a?t:e,this.outcome):this.queue.push(new l(n,t,e)),n},l.prototype.callFulfilled=function(t){s.resolve(this.promise,t)},l.prototype.otherCallFulfilled=function(t){h(this.promise,this.onFulfilled,t)},l.prototype.callRejected=function(t){s.reject(this.promise,t)},l.prototype.otherCallRejected=function(t){h(this.promise,this.onRejected,t)},s.resolve=function(t,e){var n=f(d,e);if("error"===n.status)return s.reject(t,n.value);var r=n.value;if(r)p(t,r);else{t.state=a,t.outcome=e;for(var i=-1,o=t.queue.length;++i<o;)t.queue[i].callFulfilled(e)}return t},s.reject=function(t,e){t.state=o,t.outcome=e;for(var n=-1,r=t.queue.length;++n<r;)t.queue[n].callRejected(e);return t},u.resolve=function(t){return t instanceof this?t:s.resolve(new this(i),t)},u.reject=function(t){var e=new this(i);return s.reject(e,t)},u.all=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var n=t.length,r=!1;if(!n)return this.resolve([]);for(var o=new Array(n),a=0,c=-1,u=new this(i);++c<n;)l(t[c],c);return u;function l(t,i){e.resolve(t).then((function(t){o[i]=t,++a!==n||r||(r=!0,s.resolve(u,o))}),(function(t){r||(r=!0,s.reject(u,t))}))}},u.race=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var n=t.length,r=!1;if(!n)return this.resolve([]);for(var o,a=-1,c=new this(i);++a<n;)o=t[a],e.resolve(o).then((function(t){r||(r=!0,s.resolve(c,t))}),(function(t){r||(r=!0,s.reject(c,t))}));return c}},{immediate:36}],38:[function(t,e,n){"use strict";var r={};(0,t("./lib/utils/common").assign)(r,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),e.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,e,n){"use strict";var r=t("./zlib/deflate"),i=t("./utils/common"),s=t("./utils/strings"),o=t("./zlib/messages"),a=t("./zlib/zstream"),c=Object.prototype.toString,u=0,l=-1,h=0,d=8;function p(t){if(!(this instanceof p))return new p(t);this.options=i.assign({level:l,method:d,chunkSize:16384,windowBits:15,memLevel:8,strategy:h,to:""},t||{});var e=this.options;e.raw&&0<e.windowBits?e.windowBits=-e.windowBits:e.gzip&&0<e.windowBits&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var n=r.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==u)throw new Error(o[n]);if(e.header&&r.deflateSetHeader(this.strm,e.header),e.dictionary){var f;if(f="string"==typeof e.dictionary?s.string2buf(e.dictionary):"[object ArrayBuffer]"===c.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,(n=r.deflateSetDictionary(this.strm,f))!==u)throw new Error(o[n]);this._dict_set=!0}}function f(t,e){var n=new p(e);if(n.push(t,!0),n.err)throw n.msg||o[n.err];return n.result}p.prototype.push=function(t,e){var n,o,a=this.strm,l=this.options.chunkSize;if(this.ended)return!1;o=e===~~e?e:!0===e?4:0,"string"==typeof t?a.input=s.string2buf(t):"[object ArrayBuffer]"===c.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new i.Buf8(l),a.next_out=0,a.avail_out=l),1!==(n=r.deflate(a,o))&&n!==u)return this.onEnd(n),!(this.ended=!0);0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(s.buf2binstring(i.shrinkBuf(a.output,a.next_out))):this.onData(i.shrinkBuf(a.output,a.next_out)))}while((0<a.avail_in||0===a.avail_out)&&1!==n);return 4===o?(n=r.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===u):2!==o||(this.onEnd(u),!(a.avail_out=0))},p.prototype.onData=function(t){this.chunks.push(t)},p.prototype.onEnd=function(t){t===u&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},n.Deflate=p,n.deflate=f,n.deflateRaw=function(t,e){return(e=e||{}).raw=!0,f(t,e)},n.gzip=function(t,e){return(e=e||{}).gzip=!0,f(t,e)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,e,n){"use strict";var r=t("./zlib/inflate"),i=t("./utils/common"),s=t("./utils/strings"),o=t("./zlib/constants"),a=t("./zlib/messages"),c=t("./zlib/zstream"),u=t("./zlib/gzheader"),l=Object.prototype.toString;function h(t){if(!(this instanceof h))return new h(t);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&0<=e.windowBits&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(0<=e.windowBits&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),15<e.windowBits&&e.windowBits<48&&!(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var n=r.inflateInit2(this.strm,e.windowBits);if(n!==o.Z_OK)throw new Error(a[n]);if(this.header=new u,r.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=s.string2buf(e.dictionary):"[object ArrayBuffer]"===l.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=r.inflateSetDictionary(this.strm,e.dictionary))!==o.Z_OK))throw new Error(a[n])}function d(t,e){var n=new h(e);if(n.push(t,!0),n.err)throw n.msg||a[n.err];return n.result}h.prototype.push=function(t,e){var n,a,c,u,h,d=this.strm,p=this.options.chunkSize,f=this.options.dictionary,m=!1;if(this.ended)return!1;a=e===~~e?e:!0===e?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof t?d.input=s.binstring2buf(t):"[object ArrayBuffer]"===l.call(t)?d.input=new Uint8Array(t):d.input=t,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new i.Buf8(p),d.next_out=0,d.avail_out=p),(n=r.inflate(d,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&f&&(n=r.inflateSetDictionary(this.strm,f)),n===o.Z_BUF_ERROR&&!0===m&&(n=o.Z_OK,m=!1),n!==o.Z_STREAM_END&&n!==o.Z_OK)return this.onEnd(n),!(this.ended=!0);d.next_out&&(0!==d.avail_out&&n!==o.Z_STREAM_END&&(0!==d.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(c=s.utf8border(d.output,d.next_out),u=d.next_out-c,h=s.buf2string(d.output,c),d.next_out=u,d.avail_out=p-u,u&&i.arraySet(d.output,d.output,c,u,0),this.onData(h)):this.onData(i.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(m=!0)}while((0<d.avail_in||0===d.avail_out)&&n!==o.Z_STREAM_END);return n===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(n=r.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(d.avail_out=0))},h.prototype.onData=function(t){this.chunks.push(t)},h.prototype.onEnd=function(t){t===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},n.Inflate=h,n.inflate=d,n.inflateRaw=function(t,e){return(e=e||{}).raw=!0,d(t,e)},n.ungzip=d},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,e,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;n.assign=function(t){for(var e,n,r=Array.prototype.slice.call(arguments,1);r.length;){var i=r.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var s in i)e=i,n=s,Object.prototype.hasOwnProperty.call(e,n)&&(t[s]=i[s])}}return t},n.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var i={arraySet:function(t,e,n,r,i){if(e.subarray&&t.subarray)t.set(e.subarray(n,n+r),i);else for(var s=0;s<r;s++)t[i+s]=e[n+s]},flattenChunks:function(t){var e,n,r,i,s,o;for(e=r=0,n=t.length;e<n;e++)r+=t[e].length;for(o=new Uint8Array(r),e=i=0,n=t.length;e<n;e++)s=t[e],o.set(s,i),i+=s.length;return o}},s={arraySet:function(t,e,n,r,i){for(var s=0;s<r;s++)t[i+s]=e[n+s]},flattenChunks:function(t){return[].concat.apply([],t)}};n.setTyped=function(t){t?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,i)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,s))},n.setTyped(r)},{}],42:[function(t,e,n){"use strict";var r=t("./common"),i=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(t){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){s=!1}for(var o=new r.Buf8(256),a=0;a<256;a++)o[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function c(t,e){if(e<65534&&(t.subarray&&s||!t.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(t,e));for(var n="",o=0;o<e;o++)n+=String.fromCharCode(t[o]);return n}o[254]=o[254]=1,n.string2buf=function(t){var e,n,i,s,o,a=t.length,c=0;for(s=0;s<a;s++)55296==(64512&(n=t.charCodeAt(s)))&&s+1<a&&56320==(64512&(i=t.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(i-56320),s++),c+=n<128?1:n<2048?2:n<65536?3:4;for(e=new r.Buf8(c),s=o=0;o<c;s++)55296==(64512&(n=t.charCodeAt(s)))&&s+1<a&&56320==(64512&(i=t.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(i-56320),s++),n<128?e[o++]=n:(n<2048?e[o++]=192|n>>>6:(n<65536?e[o++]=224|n>>>12:(e[o++]=240|n>>>18,e[o++]=128|n>>>12&63),e[o++]=128|n>>>6&63),e[o++]=128|63&n);return e},n.buf2binstring=function(t){return c(t,t.length)},n.binstring2buf=function(t){for(var e=new r.Buf8(t.length),n=0,i=e.length;n<i;n++)e[n]=t.charCodeAt(n);return e},n.buf2string=function(t,e){var n,r,i,s,a=e||t.length,u=new Array(2*a);for(n=r=0;n<a;)if((i=t[n++])<128)u[r++]=i;else if(4<(s=o[i]))u[r++]=65533,n+=s-1;else{for(i&=2===s?31:3===s?15:7;1<s&&n<a;)i=i<<6|63&t[n++],s--;1<s?u[r++]=65533:i<65536?u[r++]=i:(i-=65536,u[r++]=55296|i>>10&1023,u[r++]=56320|1023&i)}return c(u,r)},n.utf8border=function(t,e){var n;for((e=e||t.length)>t.length&&(e=t.length),n=e-1;0<=n&&128==(192&t[n]);)n--;return n<0||0===n?e:n+o[t[n]]>e?n:e}},{"./common":41}],43:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){for(var i=65535&t,s=t>>>16&65535,o=0;0!==n;){for(n-=o=2e3<n?2e3:n;s=s+(i=i+e[r++]|0)|0,--o;);i%=65521,s%=65521}return i|s<<16}},{}],44:[function(t,e,n){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(t,e,n){"use strict";var r=function(){for(var t,e=[],n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}();e.exports=function(t,e,n,i){var s=r,o=i+n;t^=-1;for(var a=i;a<o;a++)t=t>>>8^s[255&(t^e[a])];return~t}},{}],46:[function(t,e,n){"use strict";var r,i=t("../utils/common"),s=t("./trees"),o=t("./adler32"),a=t("./crc32"),c=t("./messages"),u=0,l=4,h=0,d=-2,p=-1,f=4,m=2,g=8,b=9,y=286,v=30,w=19,T=2*y+1,E=15,A=3,k=258,I=k+A+1,S=42,x=113,O=1,M=2,N=3,C=4;function R(t,e){return t.msg=c[e],e}function D(t){return(t<<1)-(4<t?9:0)}function P(t){for(var e=t.length;0<=--e;)t[e]=0}function L(t){var e=t.state,n=e.pending;n>t.avail_out&&(n=t.avail_out),0!==n&&(i.arraySet(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))}function B(t,e){s._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,L(t.strm)}function U(t,e){t.pending_buf[t.pending++]=e}function j(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function F(t,e){var n,r,i=t.max_chain_length,s=t.strstart,o=t.prev_length,a=t.nice_match,c=t.strstart>t.w_size-I?t.strstart-(t.w_size-I):0,u=t.window,l=t.w_mask,h=t.prev,d=t.strstart+k,p=u[s+o-1],f=u[s+o];t.prev_length>=t.good_match&&(i>>=2),a>t.lookahead&&(a=t.lookahead);do{if(u[(n=e)+o]===f&&u[n+o-1]===p&&u[n]===u[s]&&u[++n]===u[s+1]){s+=2,n++;do{}while(u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&s<d);if(r=k-(d-s),s=d-k,o<r){if(t.match_start=e,a<=(o=r))break;p=u[s+o-1],f=u[s+o]}}}while((e=h[e&l])>c&&0!=--i);return o<=t.lookahead?o:t.lookahead}function z(t){var e,n,r,s,c,u,l,h,d,p,f=t.w_size;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=f+(f-I)){for(i.arraySet(t.window,t.window,f,f,0),t.match_start-=f,t.strstart-=f,t.block_start-=f,e=n=t.hash_size;r=t.head[--e],t.head[e]=f<=r?r-f:0,--n;);for(e=n=f;r=t.prev[--e],t.prev[e]=f<=r?r-f:0,--n;);s+=f}if(0===t.strm.avail_in)break;if(u=t.strm,l=t.window,h=t.strstart+t.lookahead,p=void 0,(d=s)<(p=u.avail_in)&&(p=d),n=0===p?0:(u.avail_in-=p,i.arraySet(l,u.input,u.next_in,p,h),1===u.state.wrap?u.adler=o(u.adler,l,p,h):2===u.state.wrap&&(u.adler=a(u.adler,l,p,h)),u.next_in+=p,u.total_in+=p,p),t.lookahead+=n,t.lookahead+t.insert>=A)for(c=t.strstart-t.insert,t.ins_h=t.window[c],t.ins_h=(t.ins_h<<t.hash_shift^t.window[c+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[c+A-1])&t.hash_mask,t.prev[c&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=c,c++,t.insert--,!(t.lookahead+t.insert<A)););}while(t.lookahead<I&&0!==t.strm.avail_in)}function V(t,e){for(var n,r;;){if(t.lookahead<I){if(z(t),t.lookahead<I&&e===u)return O;if(0===t.lookahead)break}if(n=0,t.lookahead>=A&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+A-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==n&&t.strstart-n<=t.w_size-I&&(t.match_length=F(t,n)),t.match_length>=A)if(r=s._tr_tally(t,t.strstart-t.match_start,t.match_length-A),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=A){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+A-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart,0!=--t.match_length;);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else r=s._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(B(t,!1),0===t.strm.avail_out))return O}return t.insert=t.strstart<A-1?t.strstart:A-1,e===l?(B(t,!0),0===t.strm.avail_out?N:C):t.last_lit&&(B(t,!1),0===t.strm.avail_out)?O:M}function G(t,e){for(var n,r,i;;){if(t.lookahead<I){if(z(t),t.lookahead<I&&e===u)return O;if(0===t.lookahead)break}if(n=0,t.lookahead>=A&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+A-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=A-1,0!==n&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-I&&(t.match_length=F(t,n),t.match_length<=5&&(1===t.strategy||t.match_length===A&&4096<t.strstart-t.match_start)&&(t.match_length=A-1)),t.prev_length>=A&&t.match_length<=t.prev_length){for(i=t.strstart+t.lookahead-A,r=s._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-A),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=i&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+A-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!=--t.prev_length;);if(t.match_available=0,t.match_length=A-1,t.strstart++,r&&(B(t,!1),0===t.strm.avail_out))return O}else if(t.match_available){if((r=s._tr_tally(t,0,t.window[t.strstart-1]))&&B(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return O}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=s._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<A-1?t.strstart:A-1,e===l?(B(t,!0),0===t.strm.avail_out?N:C):t.last_lit&&(B(t,!1),0===t.strm.avail_out)?O:M}function Y(t,e,n,r,i){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=r,this.func=i}function H(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=g,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*T),this.dyn_dtree=new i.Buf16(2*(2*v+1)),this.bl_tree=new i.Buf16(2*(2*w+1)),P(this.dyn_ltree),P(this.dyn_dtree),P(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(E+1),this.heap=new i.Buf16(2*y+1),P(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*y+1),P(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function W(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=m,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?S:x,t.adler=2===e.wrap?0:1,e.last_flush=u,s._tr_init(e),h):R(t,d)}function K(t){var e=W(t);return e===h&&function(t){t.window_size=2*t.w_size,P(t.head),t.max_lazy_match=r[t.level].max_lazy,t.good_match=r[t.level].good_length,t.nice_match=r[t.level].nice_length,t.max_chain_length=r[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=A-1,t.match_available=0,t.ins_h=0}(t.state),e}function q(t,e,n,r,s,o){if(!t)return d;var a=1;if(e===p&&(e=6),r<0?(a=0,r=-r):15<r&&(a=2,r-=16),s<1||b<s||n!==g||r<8||15<r||e<0||9<e||o<0||f<o)return R(t,d);8===r&&(r=9);var c=new H;return(t.state=c).strm=t,c.wrap=a,c.gzhead=null,c.w_bits=r,c.w_size=1<<c.w_bits,c.w_mask=c.w_size-1,c.hash_bits=s+7,c.hash_size=1<<c.hash_bits,c.hash_mask=c.hash_size-1,c.hash_shift=~~((c.hash_bits+A-1)/A),c.window=new i.Buf8(2*c.w_size),c.head=new i.Buf16(c.hash_size),c.prev=new i.Buf16(c.w_size),c.lit_bufsize=1<<s+6,c.pending_buf_size=4*c.lit_bufsize,c.pending_buf=new i.Buf8(c.pending_buf_size),c.d_buf=1*c.lit_bufsize,c.l_buf=3*c.lit_bufsize,c.level=e,c.strategy=o,c.method=n,K(t)}r=[new Y(0,0,0,0,(function(t,e){var n=65535;for(n>t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(z(t),0===t.lookahead&&e===u)return O;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+n;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,B(t,!1),0===t.strm.avail_out))return O;if(t.strstart-t.block_start>=t.w_size-I&&(B(t,!1),0===t.strm.avail_out))return O}return t.insert=0,e===l?(B(t,!0),0===t.strm.avail_out?N:C):(t.strstart>t.block_start&&(B(t,!1),t.strm.avail_out),O)})),new Y(4,4,8,4,V),new Y(4,5,16,8,V),new Y(4,6,32,32,V),new Y(4,4,16,16,G),new Y(8,16,32,32,G),new Y(8,16,128,128,G),new Y(8,32,128,256,G),new Y(32,128,258,1024,G),new Y(32,258,258,4096,G)],n.deflateInit=function(t,e){return q(t,e,g,15,8,0)},n.deflateInit2=q,n.deflateReset=K,n.deflateResetKeep=W,n.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?d:(t.state.gzhead=e,h):d},n.deflate=function(t,e){var n,i,o,c;if(!t||!t.state||5<e||e<0)return t?R(t,d):d;if(i=t.state,!t.output||!t.input&&0!==t.avail_in||666===i.status&&e!==l)return R(t,0===t.avail_out?-5:d);if(i.strm=t,n=i.last_flush,i.last_flush=e,i.status===S)if(2===i.wrap)t.adler=0,U(i,31),U(i,139),U(i,8),i.gzhead?(U(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),U(i,255&i.gzhead.time),U(i,i.gzhead.time>>8&255),U(i,i.gzhead.time>>16&255),U(i,i.gzhead.time>>24&255),U(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),U(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(U(i,255&i.gzhead.extra.length),U(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=a(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(U(i,0),U(i,0),U(i,0),U(i,0),U(i,0),U(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),U(i,3),i.status=x);else{var p=g+(i.w_bits-8<<4)<<8;p|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(p|=32),p+=31-p%31,i.status=x,j(i,p),0!==i.strstart&&(j(i,t.adler>>>16),j(i,65535&t.adler)),t.adler=1}if(69===i.status)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(t.adler=a(t.adler,i.pending_buf,i.pending-o,o)),L(t),o=i.pending,i.pending!==i.pending_buf_size));)U(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(t.adler=a(t.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(t.adler=a(t.adler,i.pending_buf,i.pending-o,o)),L(t),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,U(i,c)}while(0!==c);i.gzhead.hcrc&&i.pending>o&&(t.adler=a(t.adler,i.pending_buf,i.pending-o,o)),0===c&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(t.adler=a(t.adler,i.pending_buf,i.pending-o,o)),L(t),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,U(i,c)}while(0!==c);i.gzhead.hcrc&&i.pending>o&&(t.adler=a(t.adler,i.pending_buf,i.pending-o,o)),0===c&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&L(t),i.pending+2<=i.pending_buf_size&&(U(i,255&t.adler),U(i,t.adler>>8&255),t.adler=0,i.status=x)):i.status=x),0!==i.pending){if(L(t),0===t.avail_out)return i.last_flush=-1,h}else if(0===t.avail_in&&D(e)<=D(n)&&e!==l)return R(t,-5);if(666===i.status&&0!==t.avail_in)return R(t,-5);if(0!==t.avail_in||0!==i.lookahead||e!==u&&666!==i.status){var f=2===i.strategy?function(t,e){for(var n;;){if(0===t.lookahead&&(z(t),0===t.lookahead)){if(e===u)return O;break}if(t.match_length=0,n=s._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(B(t,!1),0===t.strm.avail_out))return O}return t.insert=0,e===l?(B(t,!0),0===t.strm.avail_out?N:C):t.last_lit&&(B(t,!1),0===t.strm.avail_out)?O:M}(i,e):3===i.strategy?function(t,e){for(var n,r,i,o,a=t.window;;){if(t.lookahead<=k){if(z(t),t.lookahead<=k&&e===u)return O;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=A&&0<t.strstart&&(r=a[i=t.strstart-1])===a[++i]&&r===a[++i]&&r===a[++i]){o=t.strstart+k;do{}while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&i<o);t.match_length=k-(o-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=A?(n=s._tr_tally(t,1,t.match_length-A),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=s._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(B(t,!1),0===t.strm.avail_out))return O}return t.insert=0,e===l?(B(t,!0),0===t.strm.avail_out?N:C):t.last_lit&&(B(t,!1),0===t.strm.avail_out)?O:M}(i,e):r[i.level].func(i,e);if(f!==N&&f!==C||(i.status=666),f===O||f===N)return 0===t.avail_out&&(i.last_flush=-1),h;if(f===M&&(1===e?s._tr_align(i):5!==e&&(s._tr_stored_block(i,0,0,!1),3===e&&(P(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),L(t),0===t.avail_out))return i.last_flush=-1,h}return e!==l?h:i.wrap<=0?1:(2===i.wrap?(U(i,255&t.adler),U(i,t.adler>>8&255),U(i,t.adler>>16&255),U(i,t.adler>>24&255),U(i,255&t.total_in),U(i,t.total_in>>8&255),U(i,t.total_in>>16&255),U(i,t.total_in>>24&255)):(j(i,t.adler>>>16),j(i,65535&t.adler)),L(t),0<i.wrap&&(i.wrap=-i.wrap),0!==i.pending?h:1)},n.deflateEnd=function(t){var e;return t&&t.state?(e=t.state.status)!==S&&69!==e&&73!==e&&91!==e&&103!==e&&e!==x&&666!==e?R(t,d):(t.state=null,e===x?R(t,-3):h):d},n.deflateSetDictionary=function(t,e){var n,r,s,a,c,u,l,p,f=e.length;if(!t||!t.state)return d;if(2===(a=(n=t.state).wrap)||1===a&&n.status!==S||n.lookahead)return d;for(1===a&&(t.adler=o(t.adler,e,f,0)),n.wrap=0,f>=n.w_size&&(0===a&&(P(n.head),n.strstart=0,n.block_start=0,n.insert=0),p=new i.Buf8(n.w_size),i.arraySet(p,e,f-n.w_size,n.w_size,0),e=p,f=n.w_size),c=t.avail_in,u=t.next_in,l=t.input,t.avail_in=f,t.next_in=0,t.input=e,z(n);n.lookahead>=A;){for(r=n.strstart,s=n.lookahead-(A-1);n.ins_h=(n.ins_h<<n.hash_shift^n.window[r+A-1])&n.hash_mask,n.prev[r&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=r,r++,--s;);n.strstart=r,n.lookahead=A-1,z(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=A-1,n.match_available=0,t.next_in=u,t.input=l,t.avail_in=c,n.wrap=a,h},n.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,e,n){"use strict";e.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(t,e,n){"use strict";e.exports=function(t,e){var n,r,i,s,o,a,c,u,l,h,d,p,f,m,g,b,y,v,w,T,E,A,k,I,S;n=t.state,r=t.next_in,I=t.input,i=r+(t.avail_in-5),s=t.next_out,S=t.output,o=s-(e-t.avail_out),a=s+(t.avail_out-257),c=n.dmax,u=n.wsize,l=n.whave,h=n.wnext,d=n.window,p=n.hold,f=n.bits,m=n.lencode,g=n.distcode,b=(1<<n.lenbits)-1,y=(1<<n.distbits)-1;t:do{f<15&&(p+=I[r++]<<f,f+=8,p+=I[r++]<<f,f+=8),v=m[p&b];e:for(;;){if(p>>>=w=v>>>24,f-=w,0==(w=v>>>16&255))S[s++]=65535&v;else{if(!(16&w)){if(!(64&w)){v=m[(65535&v)+(p&(1<<w)-1)];continue e}if(32&w){n.mode=12;break t}t.msg="invalid literal/length code",n.mode=30;break t}T=65535&v,(w&=15)&&(f<w&&(p+=I[r++]<<f,f+=8),T+=p&(1<<w)-1,p>>>=w,f-=w),f<15&&(p+=I[r++]<<f,f+=8,p+=I[r++]<<f,f+=8),v=g[p&y];n:for(;;){if(p>>>=w=v>>>24,f-=w,!(16&(w=v>>>16&255))){if(!(64&w)){v=g[(65535&v)+(p&(1<<w)-1)];continue n}t.msg="invalid distance code",n.mode=30;break t}if(E=65535&v,f<(w&=15)&&(p+=I[r++]<<f,(f+=8)<w&&(p+=I[r++]<<f,f+=8)),c<(E+=p&(1<<w)-1)){t.msg="invalid distance too far back",n.mode=30;break t}if(p>>>=w,f-=w,(w=s-o)<E){if(l<(w=E-w)&&n.sane){t.msg="invalid distance too far back",n.mode=30;break t}if(k=d,(A=0)===h){if(A+=u-w,w<T){for(T-=w;S[s++]=d[A++],--w;);A=s-E,k=S}}else if(h<w){if(A+=u+h-w,(w-=h)<T){for(T-=w;S[s++]=d[A++],--w;);if(A=0,h<T){for(T-=w=h;S[s++]=d[A++],--w;);A=s-E,k=S}}}else if(A+=h-w,w<T){for(T-=w;S[s++]=d[A++],--w;);A=s-E,k=S}for(;2<T;)S[s++]=k[A++],S[s++]=k[A++],S[s++]=k[A++],T-=3;T&&(S[s++]=k[A++],1<T&&(S[s++]=k[A++]))}else{for(A=s-E;S[s++]=S[A++],S[s++]=S[A++],S[s++]=S[A++],2<(T-=3););T&&(S[s++]=S[A++],1<T&&(S[s++]=S[A++]))}break}}break}}while(r<i&&s<a);r-=T=f>>3,p&=(1<<(f-=T<<3))-1,t.next_in=r,t.next_out=s,t.avail_in=r<i?i-r+5:5-(r-i),t.avail_out=s<a?a-s+257:257-(s-a),n.hold=p,n.bits=f}},{}],49:[function(t,e,n){"use strict";var r=t("../utils/common"),i=t("./adler32"),s=t("./crc32"),o=t("./inffast"),a=t("./inftrees"),c=1,u=2,l=0,h=-2,d=1,p=852,f=592;function m(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function g(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function b(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=d,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new r.Buf32(p),e.distcode=e.distdyn=new r.Buf32(f),e.sane=1,e.back=-1,l):h}function y(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,b(t)):h}function v(t,e){var n,r;return t&&t.state?(r=t.state,e<0?(n=0,e=-e):(n=1+(e>>4),e<48&&(e&=15)),e&&(e<8||15<e)?h:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,y(t))):h}function w(t,e){var n,r;return t?(r=new g,(t.state=r).window=null,(n=v(t,e))!==l&&(t.state=null),n):h}var T,E,A=!0;function k(t){if(A){var e;for(T=new r.Buf32(512),E=new r.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(a(c,t.lens,0,288,T,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;a(u,t.lens,0,32,E,0,t.work,{bits:5}),A=!1}t.lencode=T,t.lenbits=9,t.distcode=E,t.distbits=5}function I(t,e,n,i){var s,o=t.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new r.Buf8(o.wsize)),i>=o.wsize?(r.arraySet(o.window,e,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i<(s=o.wsize-o.wnext)&&(s=i),r.arraySet(o.window,e,n-i,s,o.wnext),(i-=s)?(r.arraySet(o.window,e,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=s))),0}n.inflateReset=y,n.inflateReset2=v,n.inflateResetKeep=b,n.inflateInit=function(t){return w(t,15)},n.inflateInit2=w,n.inflate=function(t,e){var n,p,f,g,b,y,v,w,T,E,A,S,x,O,M,N,C,R,D,P,L,B,U,j,F=0,z=new r.Buf8(4),V=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return h;12===(n=t.state).mode&&(n.mode=13),b=t.next_out,f=t.output,v=t.avail_out,g=t.next_in,p=t.input,y=t.avail_in,w=n.hold,T=n.bits,E=y,A=v,B=l;t:for(;;)switch(n.mode){case d:if(0===n.wrap){n.mode=13;break}for(;T<16;){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}if(2&n.wrap&&35615===w){z[n.check=0]=255&w,z[1]=w>>>8&255,n.check=s(n.check,z,2,0),T=w=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&w)<<8)+(w>>8))%31){t.msg="incorrect header check",n.mode=30;break}if(8!=(15&w)){t.msg="unknown compression method",n.mode=30;break}if(T-=4,L=8+(15&(w>>>=4)),0===n.wbits)n.wbits=L;else if(L>n.wbits){t.msg="invalid window size",n.mode=30;break}n.dmax=1<<L,t.adler=n.check=1,n.mode=512&w?10:12,T=w=0;break;case 2:for(;T<16;){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}if(n.flags=w,8!=(255&n.flags)){t.msg="unknown compression method",n.mode=30;break}if(57344&n.flags){t.msg="unknown header flags set",n.mode=30;break}n.head&&(n.head.text=w>>8&1),512&n.flags&&(z[0]=255&w,z[1]=w>>>8&255,n.check=s(n.check,z,2,0)),T=w=0,n.mode=3;case 3:for(;T<32;){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}n.head&&(n.head.time=w),512&n.flags&&(z[0]=255&w,z[1]=w>>>8&255,z[2]=w>>>16&255,z[3]=w>>>24&255,n.check=s(n.check,z,4,0)),T=w=0,n.mode=4;case 4:for(;T<16;){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}n.head&&(n.head.xflags=255&w,n.head.os=w>>8),512&n.flags&&(z[0]=255&w,z[1]=w>>>8&255,n.check=s(n.check,z,2,0)),T=w=0,n.mode=5;case 5:if(1024&n.flags){for(;T<16;){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}n.length=w,n.head&&(n.head.extra_len=w),512&n.flags&&(z[0]=255&w,z[1]=w>>>8&255,n.check=s(n.check,z,2,0)),T=w=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(y<(S=n.length)&&(S=y),S&&(n.head&&(L=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,p,g,S,L)),512&n.flags&&(n.check=s(n.check,p,S,g)),y-=S,g+=S,n.length-=S),n.length))break t;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===y)break t;for(S=0;L=p[g+S++],n.head&&L&&n.length<65536&&(n.head.name+=String.fromCharCode(L)),L&&S<y;);if(512&n.flags&&(n.check=s(n.check,p,S,g)),y-=S,g+=S,L)break t}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===y)break t;for(S=0;L=p[g+S++],n.head&&L&&n.length<65536&&(n.head.comment+=String.fromCharCode(L)),L&&S<y;);if(512&n.flags&&(n.check=s(n.check,p,S,g)),y-=S,g+=S,L)break t}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;T<16;){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}if(w!==(65535&n.check)){t.msg="header crc mismatch",n.mode=30;break}T=w=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=12;break;case 10:for(;T<32;){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}t.adler=n.check=m(w),T=w=0,n.mode=11;case 11:if(0===n.havedict)return t.next_out=b,t.avail_out=v,t.next_in=g,t.avail_in=y,n.hold=w,n.bits=T,2;t.adler=n.check=1,n.mode=12;case 12:if(5===e||6===e)break t;case 13:if(n.last){w>>>=7&T,T-=7&T,n.mode=27;break}for(;T<3;){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}switch(n.last=1&w,T-=1,3&(w>>>=1)){case 0:n.mode=14;break;case 1:if(k(n),n.mode=20,6!==e)break;w>>>=2,T-=2;break t;case 2:n.mode=17;break;case 3:t.msg="invalid block type",n.mode=30}w>>>=2,T-=2;break;case 14:for(w>>>=7&T,T-=7&T;T<32;){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}if((65535&w)!=(w>>>16^65535)){t.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&w,T=w=0,n.mode=15,6===e)break t;case 15:n.mode=16;case 16:if(S=n.length){if(y<S&&(S=y),v<S&&(S=v),0===S)break t;r.arraySet(f,p,g,S,b),y-=S,g+=S,v-=S,b+=S,n.length-=S;break}n.mode=12;break;case 17:for(;T<14;){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}if(n.nlen=257+(31&w),w>>>=5,T-=5,n.ndist=1+(31&w),w>>>=5,T-=5,n.ncode=4+(15&w),w>>>=4,T-=4,286<n.nlen||30<n.ndist){t.msg="too many length or distance symbols",n.mode=30;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;T<3;){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}n.lens[V[n.have++]]=7&w,w>>>=3,T-=3}for(;n.have<19;)n.lens[V[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,U={bits:n.lenbits},B=a(0,n.lens,0,19,n.lencode,0,n.work,U),n.lenbits=U.bits,B){t.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;N=(F=n.lencode[w&(1<<n.lenbits)-1])>>>16&255,C=65535&F,!((M=F>>>24)<=T);){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}if(C<16)w>>>=M,T-=M,n.lens[n.have++]=C;else{if(16===C){for(j=M+2;T<j;){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}if(w>>>=M,T-=M,0===n.have){t.msg="invalid bit length repeat",n.mode=30;break}L=n.lens[n.have-1],S=3+(3&w),w>>>=2,T-=2}else if(17===C){for(j=M+3;T<j;){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}T-=M,L=0,S=3+(7&(w>>>=M)),w>>>=3,T-=3}else{for(j=M+7;T<j;){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}T-=M,L=0,S=11+(127&(w>>>=M)),w>>>=7,T-=7}if(n.have+S>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=30;break}for(;S--;)n.lens[n.have++]=L}}if(30===n.mode)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,U={bits:n.lenbits},B=a(c,n.lens,0,n.nlen,n.lencode,0,n.work,U),n.lenbits=U.bits,B){t.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,U={bits:n.distbits},B=a(u,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,U),n.distbits=U.bits,B){t.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===e)break t;case 20:n.mode=21;case 21:if(6<=y&&258<=v){t.next_out=b,t.avail_out=v,t.next_in=g,t.avail_in=y,n.hold=w,n.bits=T,o(t,A),b=t.next_out,f=t.output,v=t.avail_out,g=t.next_in,p=t.input,y=t.avail_in,w=n.hold,T=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;N=(F=n.lencode[w&(1<<n.lenbits)-1])>>>16&255,C=65535&F,!((M=F>>>24)<=T);){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}if(N&&!(240&N)){for(R=M,D=N,P=C;N=(F=n.lencode[P+((w&(1<<R+D)-1)>>R)])>>>16&255,C=65535&F,!(R+(M=F>>>24)<=T);){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}w>>>=R,T-=R,n.back+=R}if(w>>>=M,T-=M,n.back+=M,n.length=C,0===N){n.mode=26;break}if(32&N){n.back=-1,n.mode=12;break}if(64&N){t.msg="invalid literal/length code",n.mode=30;break}n.extra=15&N,n.mode=22;case 22:if(n.extra){for(j=n.extra;T<j;){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}n.length+=w&(1<<n.extra)-1,w>>>=n.extra,T-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;N=(F=n.distcode[w&(1<<n.distbits)-1])>>>16&255,C=65535&F,!((M=F>>>24)<=T);){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}if(!(240&N)){for(R=M,D=N,P=C;N=(F=n.distcode[P+((w&(1<<R+D)-1)>>R)])>>>16&255,C=65535&F,!(R+(M=F>>>24)<=T);){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}w>>>=R,T-=R,n.back+=R}if(w>>>=M,T-=M,n.back+=M,64&N){t.msg="invalid distance code",n.mode=30;break}n.offset=C,n.extra=15&N,n.mode=24;case 24:if(n.extra){for(j=n.extra;T<j;){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}n.offset+=w&(1<<n.extra)-1,w>>>=n.extra,T-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===v)break t;if(S=A-v,n.offset>S){if((S=n.offset-S)>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=30;break}x=S>n.wnext?(S-=n.wnext,n.wsize-S):n.wnext-S,S>n.length&&(S=n.length),O=n.window}else O=f,x=b-n.offset,S=n.length;for(v<S&&(S=v),v-=S,n.length-=S;f[b++]=O[x++],--S;);0===n.length&&(n.mode=21);break;case 26:if(0===v)break t;f[b++]=n.length,v--,n.mode=21;break;case 27:if(n.wrap){for(;T<32;){if(0===y)break t;y--,w|=p[g++]<<T,T+=8}if(A-=v,t.total_out+=A,n.total+=A,A&&(t.adler=n.check=n.flags?s(n.check,f,A,b-A):i(n.check,f,A,b-A)),A=v,(n.flags?w:m(w))!==n.check){t.msg="incorrect data check",n.mode=30;break}T=w=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;T<32;){if(0===y)break t;y--,w+=p[g++]<<T,T+=8}if(w!==(4294967295&n.total)){t.msg="incorrect length check",n.mode=30;break}T=w=0}n.mode=29;case 29:B=1;break t;case 30:B=-3;break t;case 31:return-4;default:return h}return t.next_out=b,t.avail_out=v,t.next_in=g,t.avail_in=y,n.hold=w,n.bits=T,(n.wsize||A!==t.avail_out&&n.mode<30&&(n.mode<27||4!==e))&&I(t,t.output,t.next_out,A-t.avail_out)?(n.mode=31,-4):(E-=t.avail_in,A-=t.avail_out,t.total_in+=E,t.total_out+=A,n.total+=A,n.wrap&&A&&(t.adler=n.check=n.flags?s(n.check,f,A,t.next_out-A):i(n.check,f,A,t.next_out-A)),t.data_type=n.bits+(n.last?64:0)+(12===n.mode?128:0)+(20===n.mode||15===n.mode?256:0),(0==E&&0===A||4===e)&&B===l&&(B=-5),B)},n.inflateEnd=function(t){if(!t||!t.state)return h;var e=t.state;return e.window&&(e.window=null),t.state=null,l},n.inflateGetHeader=function(t,e){var n;return t&&t.state&&2&(n=t.state).wrap?((n.head=e).done=!1,l):h},n.inflateSetDictionary=function(t,e){var n,r=e.length;return t&&t.state?0!==(n=t.state).wrap&&11!==n.mode?h:11===n.mode&&i(1,e,r,0)!==n.check?-3:I(t,e,r,r)?(n.mode=31,-4):(n.havedict=1,l):h},n.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,e,n){"use strict";var r=t("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],s=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],o=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(t,e,n,c,u,l,h,d){var p,f,m,g,b,y,v,w,T,E=d.bits,A=0,k=0,I=0,S=0,x=0,O=0,M=0,N=0,C=0,R=0,D=null,P=0,L=new r.Buf16(16),B=new r.Buf16(16),U=null,j=0;for(A=0;A<=15;A++)L[A]=0;for(k=0;k<c;k++)L[e[n+k]]++;for(x=E,S=15;1<=S&&0===L[S];S--);if(S<x&&(x=S),0===S)return u[l++]=20971520,u[l++]=20971520,d.bits=1,0;for(I=1;I<S&&0===L[I];I++);for(x<I&&(x=I),A=N=1;A<=15;A++)if(N<<=1,(N-=L[A])<0)return-1;if(0<N&&(0===t||1!==S))return-1;for(B[1]=0,A=1;A<15;A++)B[A+1]=B[A]+L[A];for(k=0;k<c;k++)0!==e[n+k]&&(h[B[e[n+k]]++]=k);if(y=0===t?(D=U=h,19):1===t?(D=i,P-=257,U=s,j-=257,256):(D=o,U=a,-1),A=I,b=l,M=k=R=0,m=-1,g=(C=1<<(O=x))-1,1===t&&852<C||2===t&&592<C)return 1;for(;;){for(v=A-M,T=h[k]<y?(w=0,h[k]):h[k]>y?(w=U[j+h[k]],D[P+h[k]]):(w=96,0),p=1<<A-M,I=f=1<<O;u[b+(R>>M)+(f-=p)]=v<<24|w<<16|T,0!==f;);for(p=1<<A-1;R&p;)p>>=1;if(0!==p?(R&=p-1,R+=p):R=0,k++,0==--L[A]){if(A===S)break;A=e[n+h[k]]}if(x<A&&(R&g)!==m){for(0===M&&(M=x),b+=I,N=1<<(O=A-M);O+M<S&&!((N-=L[O+M])<=0);)O++,N<<=1;if(C+=1<<O,1===t&&852<C||2===t&&592<C)return 1;u[m=R&g]=x<<24|O<<16|b-l}}return 0!==R&&(u[b+R]=A-M<<24|64<<16),d.bits=x,0}},{"../utils/common":41}],51:[function(t,e,n){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(t,e,n){"use strict";var r=t("../utils/common"),i=0,s=1;function o(t){for(var e=t.length;0<=--e;)t[e]=0}var a=0,c=29,u=256,l=u+1+c,h=30,d=19,p=2*l+1,f=15,m=16,g=7,b=256,y=16,v=17,w=18,T=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],E=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],k=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],I=new Array(2*(l+2));o(I);var S=new Array(2*h);o(S);var x=new Array(512);o(x);var O=new Array(256);o(O);var M=new Array(c);o(M);var N,C,R,D=new Array(h);function P(t,e,n,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=t&&t.length}function L(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function B(t){return t<256?x[t]:x[256+(t>>>7)]}function U(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function j(t,e,n){t.bi_valid>m-n?(t.bi_buf|=e<<t.bi_valid&65535,U(t,t.bi_buf),t.bi_buf=e>>m-t.bi_valid,t.bi_valid+=n-m):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=n)}function F(t,e,n){j(t,n[2*e],n[2*e+1])}function z(t,e){for(var n=0;n|=1&t,t>>>=1,n<<=1,0<--e;);return n>>>1}function V(t,e,n){var r,i,s=new Array(f+1),o=0;for(r=1;r<=f;r++)s[r]=o=o+n[r-1]<<1;for(i=0;i<=e;i++){var a=t[2*i+1];0!==a&&(t[2*i]=z(s[a]++,a))}}function G(t){var e;for(e=0;e<l;e++)t.dyn_ltree[2*e]=0;for(e=0;e<h;e++)t.dyn_dtree[2*e]=0;for(e=0;e<d;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*b]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function Y(t){8<t.bi_valid?U(t,t.bi_buf):0<t.bi_valid&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function H(t,e,n,r){var i=2*e,s=2*n;return t[i]<t[s]||t[i]===t[s]&&r[e]<=r[n]}function W(t,e,n){for(var r=t.heap[n],i=n<<1;i<=t.heap_len&&(i<t.heap_len&&H(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!H(e,r,t.heap[i],t.depth));)t.heap[n]=t.heap[i],n=i,i<<=1;t.heap[n]=r}function K(t,e,n){var r,i,s,o,a=0;if(0!==t.last_lit)for(;r=t.pending_buf[t.d_buf+2*a]<<8|t.pending_buf[t.d_buf+2*a+1],i=t.pending_buf[t.l_buf+a],a++,0===r?F(t,i,e):(F(t,(s=O[i])+u+1,e),0!==(o=T[s])&&j(t,i-=M[s],o),F(t,s=B(--r),n),0!==(o=E[s])&&j(t,r-=D[s],o)),a<t.last_lit;);F(t,b,e)}function q(t,e){var n,r,i,s=e.dyn_tree,o=e.stat_desc.static_tree,a=e.stat_desc.has_stree,c=e.stat_desc.elems,u=-1;for(t.heap_len=0,t.heap_max=p,n=0;n<c;n++)0!==s[2*n]?(t.heap[++t.heap_len]=u=n,t.depth[n]=0):s[2*n+1]=0;for(;t.heap_len<2;)s[2*(i=t.heap[++t.heap_len]=u<2?++u:0)]=1,t.depth[i]=0,t.opt_len--,a&&(t.static_len-=o[2*i+1]);for(e.max_code=u,n=t.heap_len>>1;1<=n;n--)W(t,s,n);for(i=c;n=t.heap[1],t.heap[1]=t.heap[t.heap_len--],W(t,s,1),r=t.heap[1],t.heap[--t.heap_max]=n,t.heap[--t.heap_max]=r,s[2*i]=s[2*n]+s[2*r],t.depth[i]=(t.depth[n]>=t.depth[r]?t.depth[n]:t.depth[r])+1,s[2*n+1]=s[2*r+1]=i,t.heap[1]=i++,W(t,s,1),2<=t.heap_len;);t.heap[--t.heap_max]=t.heap[1],function(t,e){var n,r,i,s,o,a,c=e.dyn_tree,u=e.max_code,l=e.stat_desc.static_tree,h=e.stat_desc.has_stree,d=e.stat_desc.extra_bits,m=e.stat_desc.extra_base,g=e.stat_desc.max_length,b=0;for(s=0;s<=f;s++)t.bl_count[s]=0;for(c[2*t.heap[t.heap_max]+1]=0,n=t.heap_max+1;n<p;n++)g<(s=c[2*c[2*(r=t.heap[n])+1]+1]+1)&&(s=g,b++),c[2*r+1]=s,u<r||(t.bl_count[s]++,o=0,m<=r&&(o=d[r-m]),a=c[2*r],t.opt_len+=a*(s+o),h&&(t.static_len+=a*(l[2*r+1]+o)));if(0!==b){do{for(s=g-1;0===t.bl_count[s];)s--;t.bl_count[s]--,t.bl_count[s+1]+=2,t.bl_count[g]--,b-=2}while(0<b);for(s=g;0!==s;s--)for(r=t.bl_count[s];0!==r;)u<(i=t.heap[--n])||(c[2*i+1]!==s&&(t.opt_len+=(s-c[2*i+1])*c[2*i],c[2*i+1]=s),r--)}}(t,e),V(s,u,t.bl_count)}function Q(t,e,n){var r,i,s=-1,o=e[1],a=0,c=7,u=4;for(0===o&&(c=138,u=3),e[2*(n+1)+1]=65535,r=0;r<=n;r++)i=o,o=e[2*(r+1)+1],++a<c&&i===o||(a<u?t.bl_tree[2*i]+=a:0!==i?(i!==s&&t.bl_tree[2*i]++,t.bl_tree[2*y]++):a<=10?t.bl_tree[2*v]++:t.bl_tree[2*w]++,s=i,u=(a=0)===o?(c=138,3):i===o?(c=6,3):(c=7,4))}function X(t,e,n){var r,i,s=-1,o=e[1],a=0,c=7,u=4;for(0===o&&(c=138,u=3),r=0;r<=n;r++)if(i=o,o=e[2*(r+1)+1],!(++a<c&&i===o)){if(a<u)for(;F(t,i,t.bl_tree),0!=--a;);else 0!==i?(i!==s&&(F(t,i,t.bl_tree),a--),F(t,y,t.bl_tree),j(t,a-3,2)):a<=10?(F(t,v,t.bl_tree),j(t,a-3,3)):(F(t,w,t.bl_tree),j(t,a-11,7));s=i,u=(a=0)===o?(c=138,3):i===o?(c=6,3):(c=7,4)}}o(D);var Z=!1;function J(t,e,n,i){j(t,(a<<1)+(i?1:0),3),function(t,e,n,i){Y(t),i&&(U(t,n),U(t,~n)),r.arraySet(t.pending_buf,t.window,e,n,t.pending),t.pending+=n}(t,e,n,!0)}n._tr_init=function(t){Z||(function(){var t,e,n,r,i,s=new Array(f+1);for(r=n=0;r<c-1;r++)for(M[r]=n,t=0;t<1<<T[r];t++)O[n++]=r;for(O[n-1]=r,r=i=0;r<16;r++)for(D[r]=i,t=0;t<1<<E[r];t++)x[i++]=r;for(i>>=7;r<h;r++)for(D[r]=i<<7,t=0;t<1<<E[r]-7;t++)x[256+i++]=r;for(e=0;e<=f;e++)s[e]=0;for(t=0;t<=143;)I[2*t+1]=8,t++,s[8]++;for(;t<=255;)I[2*t+1]=9,t++,s[9]++;for(;t<=279;)I[2*t+1]=7,t++,s[7]++;for(;t<=287;)I[2*t+1]=8,t++,s[8]++;for(V(I,l+1,s),t=0;t<h;t++)S[2*t+1]=5,S[2*t]=z(t,5);N=new P(I,T,u+1,l,f),C=new P(S,E,0,h,f),R=new P(new Array(0),A,0,d,g)}(),Z=!0),t.l_desc=new L(t.dyn_ltree,N),t.d_desc=new L(t.dyn_dtree,C),t.bl_desc=new L(t.bl_tree,R),t.bi_buf=0,t.bi_valid=0,G(t)},n._tr_stored_block=J,n._tr_flush_block=function(t,e,n,r){var o,a,c=0;0<t.level?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,n=4093624447;for(e=0;e<=31;e++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return i;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return s;for(e=32;e<u;e++)if(0!==t.dyn_ltree[2*e])return s;return i}(t)),q(t,t.l_desc),q(t,t.d_desc),c=function(t){var e;for(Q(t,t.dyn_ltree,t.l_desc.max_code),Q(t,t.dyn_dtree,t.d_desc.max_code),q(t,t.bl_desc),e=d-1;3<=e&&0===t.bl_tree[2*k[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),o=t.opt_len+3+7>>>3,(a=t.static_len+3+7>>>3)<=o&&(o=a)):o=a=n+5,n+4<=o&&-1!==e?J(t,e,n,r):4===t.strategy||a===o?(j(t,2+(r?1:0),3),K(t,I,S)):(j(t,4+(r?1:0),3),function(t,e,n,r){var i;for(j(t,e-257,5),j(t,n-1,5),j(t,r-4,4),i=0;i<r;i++)j(t,t.bl_tree[2*k[i]+1],3);X(t,t.dyn_ltree,e-1),X(t,t.dyn_dtree,n-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,c+1),K(t,t.dyn_ltree,t.dyn_dtree)),G(t),r&&Y(t)},n._tr_tally=function(t,e,n){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&n,t.last_lit++,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(O[n]+u+1)]++,t.dyn_dtree[2*B(e)]++),t.last_lit===t.lit_bufsize-1},n._tr_align=function(t){j(t,2,3),F(t,b,I),function(t){16===t.bi_valid?(U(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},{"../utils/common":41}],53:[function(t,e,n){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,e,n){(function(t){!function(t,e){"use strict";if(!t.setImmediate){var n,r,s,o,a=1,c={},u=!1,l=t.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(t);h=h&&h.setTimeout?h:t,n="[object process]"==={}.toString.call(t.process)?function(t){i.nextTick((function(){p(t)}))}:function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?(o="setImmediate$"+Math.random()+"$",t.addEventListener?t.addEventListener("message",f,!1):t.attachEvent("onmessage",f),function(e){t.postMessage(o+e,"*")}):t.MessageChannel?((s=new MessageChannel).port1.onmessage=function(t){p(t.data)},function(t){s.port2.postMessage(t)}):l&&"onreadystatechange"in l.createElement("script")?(r=l.documentElement,function(t){var e=l.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,r.removeChild(e),e=null},r.appendChild(e)}):function(t){setTimeout(p,0,t)},h.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),r=0;r<e.length;r++)e[r]=arguments[r+1];var i={callback:t,args:e};return c[a]=i,n(a),a++},h.clearImmediate=d}function d(t){delete c[t]}function p(t){if(u)setTimeout(p,0,t);else{var n=c[t];if(n){u=!0;try{!function(t){var n=t.callback,r=t.args;switch(r.length){case 0:n();break;case 1:n(r[0]);break;case 2:n(r[0],r[1]);break;case 3:n(r[0],r[1],r[2]);break;default:n.apply(e,r)}}(n)}finally{d(t),u=!1}}}}function f(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(o)&&p(+e.data.slice(o.length))}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)}).call(this,n(16).Buffer,n(100).setImmediate,n(8),n(35))},function(t,e){class n{static get RGB_BLACK(){return{r:0,g:0,b:0}}static get RGB_WHITE(){return{r:255,g:255,b:255}}static decimalToHex(t){t<0&&(t+=16777216);let e=Number(t).toString(16);return e="#".concat("000000".substr(0,6-e.length)).concat(e),e}static decimalToRgb(t){const e=t>>24&255;return{r:t>>16&255,g:t>>8&255,b:255&t,a:e>0?e:255}}static hexToRgb(t){t.startsWith("#")&&(t=t.substring(1));const e=parseInt(t,16);if(isNaN(e))return null;if(6===t.length)return{r:e>>16&255,g:e>>8&255,b:255&e};if(3===t.length){const t=e>>8&15,n=e>>4&15,r=15&e;return{r:t<<4|t,g:n<<4|n,b:r<<4|r}}return null}static rgbToHex(t){return n.decimalToHex(n.rgbToDecimal(t))}static rgbToDecimal(t){return(t.r<<16)+(t.g<<8)+t.b}static hexToDecimal(t){return n.rgbToDecimal(n.hexToRgb(t))}static hsvToRgb(t){let e=t.h%360;e<0&&(e+=360);const n=Math.max(0,Math.min(t.s,1)),r=Math.max(0,Math.min(t.v,1)),i=Math.floor(e/60),s=e/60-i,o=r*(1-n),a=r*(1-n*s),c=r*(1-n*(1-s));let u,l,h;switch(i){default:case 0:u=r,l=c,h=o;break;case 1:u=a,l=r,h=o;break;case 2:u=o,l=r,h=c;break;case 3:u=o,l=a,h=r;break;case 4:u=c,l=o,h=r;break;case 5:u=r,l=o,h=a}return{r:Math.floor(255*u),g:Math.floor(255*l),b:Math.floor(255*h)}}static rgbToHsv(t){const e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(Math.min(e,n),r),s=Math.max(Math.max(e,n),r);let o=0,a=0;if(i!==s){o=60*((e===i?3:n===i?5:1)-(e===i?n-r:n===i?r-e:e-n)/(s-i))%360,a=(s-i)/s}return{h:o,s:a,v:s}}static mixRgb(t,e,n){if(n<=0)return t;if(n>=1)return e;const r=1-n;return{r:r*t.r+n*e.r,g:r*t.g+n*e.g,b:r*t.b+n*e.b}}}t.exports=n},function(t,e,n){t.exports=function(){"use strict";var t=Array.prototype.slice;function e(t,e){e&&(t.prototype=Object.create(e.prototype)),t.prototype.constructor=t}function n(t){return o(t)?t:q(t)}function r(t){return a(t)?t:Q(t)}function i(t){return c(t)?t:X(t)}function s(t){return o(t)&&!u(t)?t:Z(t)}function o(t){return!(!t||!t[h])}function a(t){return!(!t||!t[d])}function c(t){return!(!t||!t[p])}function u(t){return a(t)||c(t)}function l(t){return!(!t||!t[f])}e(r,n),e(i,n),e(s,n),n.isIterable=o,n.isKeyed=a,n.isIndexed=c,n.isAssociative=u,n.isOrdered=l,n.Keyed=r,n.Indexed=i,n.Set=s;var h="@@__IMMUTABLE_ITERABLE__@@",d="@@__IMMUTABLE_KEYED__@@",p="@@__IMMUTABLE_INDEXED__@@",f="@@__IMMUTABLE_ORDERED__@@",m="delete",g=5,b=1<<g,y=b-1,v={},w={value:!1},T={value:!1};function E(t){return t.value=!1,t}function A(t){t&&(t.value=!0)}function k(){}function I(t,e){e=e||0;for(var n=Math.max(0,t.length-e),r=new Array(n),i=0;i<n;i++)r[i]=t[i+e];return r}function S(t){return void 0===t.size&&(t.size=t.__iterate(O)),t.size}function x(t,e){if("number"!=typeof e){var n=e>>>0;if(""+n!==e||4294967295===n)return NaN;e=n}return e<0?S(t)+e:e}function O(){return!0}function M(t,e,n){return(0===t||void 0!==n&&t<=-n)&&(void 0===e||void 0!==n&&e>=n)}function N(t,e){return R(t,e,0)}function C(t,e){return R(t,e,e)}function R(t,e,n){return void 0===t?n:t<0?Math.max(0,e+t):void 0===e?t:Math.min(e,t)}var D=0,P=1,L=2,B="function"==typeof Symbol&&Symbol.iterator,U="@@iterator",j=B||U;function F(t){this.next=t}function z(t,e,n,r){var i=0===t?e:1===t?n:[e,n];return r?r.value=i:r={value:i,done:!1},r}function V(){return{value:void 0,done:!0}}function G(t){return!!W(t)}function Y(t){return t&&"function"==typeof t.next}function H(t){var e=W(t);return e&&e.call(t)}function W(t){var e=t&&(B&&t[B]||t[U]);if("function"==typeof e)return e}function K(t){return t&&"number"==typeof t.length}function q(t){return null==t?ot():o(t)?t.toSeq():ut(t)}function Q(t){return null==t?ot().toKeyedSeq():o(t)?a(t)?t.toSeq():t.fromEntrySeq():at(t)}function X(t){return null==t?ot():o(t)?a(t)?t.entrySeq():t.toIndexedSeq():ct(t)}function Z(t){return(null==t?ot():o(t)?a(t)?t.entrySeq():t:ct(t)).toSetSeq()}F.prototype.toString=function(){return"[Iterator]"},F.KEYS=D,F.VALUES=P,F.ENTRIES=L,F.prototype.inspect=F.prototype.toSource=function(){return this.toString()},F.prototype[j]=function(){return this},e(q,n),q.of=function(){return q(arguments)},q.prototype.toSeq=function(){return this},q.prototype.toString=function(){return this.__toString("Seq {","}")},q.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},q.prototype.__iterate=function(t,e){return ht(this,t,e,!0)},q.prototype.__iterator=function(t,e){return dt(this,t,e,!0)},e(Q,q),Q.prototype.toKeyedSeq=function(){return this},e(X,q),X.of=function(){return X(arguments)},X.prototype.toIndexedSeq=function(){return this},X.prototype.toString=function(){return this.__toString("Seq [","]")},X.prototype.__iterate=function(t,e){return ht(this,t,e,!1)},X.prototype.__iterator=function(t,e){return dt(this,t,e,!1)},e(Z,q),Z.of=function(){return Z(arguments)},Z.prototype.toSetSeq=function(){return this},q.isSeq=st,q.Keyed=Q,q.Set=Z,q.Indexed=X;var J,_,$,tt="@@__IMMUTABLE_SEQ__@@";function et(t){this._array=t,this.size=t.length}function nt(t){var e=Object.keys(t);this._object=t,this._keys=e,this.size=e.length}function rt(t){this._iterable=t,this.size=t.length||t.size}function it(t){this._iterator=t,this._iteratorCache=[]}function st(t){return!(!t||!t[tt])}function ot(){return J||(J=new et([]))}function at(t){var e=Array.isArray(t)?new et(t).fromEntrySeq():Y(t)?new it(t).fromEntrySeq():G(t)?new rt(t).fromEntrySeq():"object"==typeof t?new nt(t):void 0;if(!e)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+t);return e}function ct(t){var e=lt(t);if(!e)throw new TypeError("Expected Array or iterable object of values: "+t);return e}function ut(t){var e=lt(t)||"object"==typeof t&&new nt(t);if(!e)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+t);return e}function lt(t){return K(t)?new et(t):Y(t)?new it(t):G(t)?new rt(t):void 0}function ht(t,e,n,r){var i=t._cache;if(i){for(var s=i.length-1,o=0;o<=s;o++){var a=i[n?s-o:o];if(!1===e(a[1],r?a[0]:o,t))return o+1}return o}return t.__iterateUncached(e,n)}function dt(t,e,n,r){var i=t._cache;if(i){var s=i.length-1,o=0;return new F((function(){var t=i[n?s-o:o];return o++>s?V():z(e,r?t[0]:o-1,t[1])}))}return t.__iteratorUncached(e,n)}function pt(t,e){return e?ft(e,t,"",{"":t}):mt(t)}function ft(t,e,n,r){return Array.isArray(e)?t.call(r,n,X(e).map((function(n,r){return ft(t,n,r,e)}))):gt(e)?t.call(r,n,Q(e).map((function(n,r){return ft(t,n,r,e)}))):e}function mt(t){return Array.isArray(t)?X(t).map(mt).toList():gt(t)?Q(t).map(mt).toMap():t}function gt(t){return t&&(t.constructor===Object||void 0===t.constructor)}function bt(t,e){if(t===e||t!=t&&e!=e)return!0;if(!t||!e)return!1;if("function"==typeof t.valueOf&&"function"==typeof e.valueOf){if((t=t.valueOf())===(e=e.valueOf())||t!=t&&e!=e)return!0;if(!t||!e)return!1}return!("function"!=typeof t.equals||"function"!=typeof e.equals||!t.equals(e))}function yt(t,e){if(t===e)return!0;if(!o(e)||void 0!==t.size&&void 0!==e.size&&t.size!==e.size||void 0!==t.__hash&&void 0!==e.__hash&&t.__hash!==e.__hash||a(t)!==a(e)||c(t)!==c(e)||l(t)!==l(e))return!1;if(0===t.size&&0===e.size)return!0;var n=!u(t);if(l(t)){var r=t.entries();return e.every((function(t,e){var i=r.next().value;return i&&bt(i[1],t)&&(n||bt(i[0],e))}))&&r.next().done}var i=!1;if(void 0===t.size)if(void 0===e.size)"function"==typeof t.cacheResult&&t.cacheResult();else{i=!0;var s=t;t=e,e=s}var h=!0,d=e.__iterate((function(e,r){if(n?!t.has(e):i?!bt(e,t.get(r,v)):!bt(t.get(r,v),e))return h=!1,!1}));return h&&t.size===d}function vt(t,e){if(!(this instanceof vt))return new vt(t,e);if(this._value=t,this.size=void 0===e?1/0:Math.max(0,e),0===this.size){if(_)return _;_=this}}function wt(t,e){if(!t)throw new Error(e)}function Tt(t,e,n){if(!(this instanceof Tt))return new Tt(t,e,n);if(wt(0!==n,"Cannot step a Range by 0"),t=t||0,void 0===e&&(e=1/0),n=void 0===n?1:Math.abs(n),e<t&&(n=-n),this._start=t,this._end=e,this._step=n,this.size=Math.max(0,Math.ceil((e-t)/n-1)+1),0===this.size){if($)return $;$=this}}function Et(){throw TypeError("Abstract")}function At(){}function kt(){}function It(){}q.prototype[tt]=!0,e(et,X),et.prototype.get=function(t,e){return this.has(t)?this._array[x(this,t)]:e},et.prototype.__iterate=function(t,e){for(var n=this._array,r=n.length-1,i=0;i<=r;i++)if(!1===t(n[e?r-i:i],i,this))return i+1;return i},et.prototype.__iterator=function(t,e){var n=this._array,r=n.length-1,i=0;return new F((function(){return i>r?V():z(t,i,n[e?r-i++:i++])}))},e(nt,Q),nt.prototype.get=function(t,e){return void 0===e||this.has(t)?this._object[t]:e},nt.prototype.has=function(t){return this._object.hasOwnProperty(t)},nt.prototype.__iterate=function(t,e){for(var n=this._object,r=this._keys,i=r.length-1,s=0;s<=i;s++){var o=r[e?i-s:s];if(!1===t(n[o],o,this))return s+1}return s},nt.prototype.__iterator=function(t,e){var n=this._object,r=this._keys,i=r.length-1,s=0;return new F((function(){var o=r[e?i-s:s];return s++>i?V():z(t,o,n[o])}))},nt.prototype[f]=!0,e(rt,X),rt.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);var n=H(this._iterable),r=0;if(Y(n))for(var i;!(i=n.next()).done&&!1!==t(i.value,r++,this););return r},rt.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var n=H(this._iterable);if(!Y(n))return new F(V);var r=0;return new F((function(){var e=n.next();return e.done?e:z(t,r++,e.value)}))},e(it,X),it.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);for(var n,r=this._iterator,i=this._iteratorCache,s=0;s<i.length;)if(!1===t(i[s],s++,this))return s;for(;!(n=r.next()).done;){var o=n.value;if(i[s]=o,!1===t(o,s++,this))break}return s},it.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var n=this._iterator,r=this._iteratorCache,i=0;return new F((function(){if(i>=r.length){var e=n.next();if(e.done)return e;r[i]=e.value}return z(t,i,r[i++])}))},e(vt,X),vt.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},vt.prototype.get=function(t,e){return this.has(t)?this._value:e},vt.prototype.includes=function(t){return bt(this._value,t)},vt.prototype.slice=function(t,e){var n=this.size;return M(t,e,n)?this:new vt(this._value,C(e,n)-N(t,n))},vt.prototype.reverse=function(){return this},vt.prototype.indexOf=function(t){return bt(this._value,t)?0:-1},vt.prototype.lastIndexOf=function(t){return bt(this._value,t)?this.size:-1},vt.prototype.__iterate=function(t,e){for(var n=0;n<this.size;n++)if(!1===t(this._value,n,this))return n+1;return n},vt.prototype.__iterator=function(t,e){var n=this,r=0;return new F((function(){return r<n.size?z(t,r++,n._value):V()}))},vt.prototype.equals=function(t){return t instanceof vt?bt(this._value,t._value):yt(t)},e(Tt,X),Tt.prototype.toString=function(){return 0===this.size?"Range []":"Range [ "+this._start+"..."+this._end+(1!==this._step?" by "+this._step:"")+" ]"},Tt.prototype.get=function(t,e){return this.has(t)?this._start+x(this,t)*this._step:e},Tt.prototype.includes=function(t){var e=(t-this._start)/this._step;return e>=0&&e<this.size&&e===Math.floor(e)},Tt.prototype.slice=function(t,e){return M(t,e,this.size)?this:(t=N(t,this.size),(e=C(e,this.size))<=t?new Tt(0,0):new Tt(this.get(t,this._end),this.get(e,this._end),this._step))},Tt.prototype.indexOf=function(t){var e=t-this._start;if(e%this._step==0){var n=e/this._step;if(n>=0&&n<this.size)return n}return-1},Tt.prototype.lastIndexOf=function(t){return this.indexOf(t)},Tt.prototype.__iterate=function(t,e){for(var n=this.size-1,r=this._step,i=e?this._start+n*r:this._start,s=0;s<=n;s++){if(!1===t(i,s,this))return s+1;i+=e?-r:r}return s},Tt.prototype.__iterator=function(t,e){var n=this.size-1,r=this._step,i=e?this._start+n*r:this._start,s=0;return new F((function(){var o=i;return i+=e?-r:r,s>n?V():z(t,s++,o)}))},Tt.prototype.equals=function(t){return t instanceof Tt?this._start===t._start&&this._end===t._end&&this._step===t._step:yt(this,t)},e(Et,n),e(At,Et),e(kt,Et),e(It,Et),Et.Keyed=At,Et.Indexed=kt,Et.Set=It;var St="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(t,e){var n=65535&(t|=0),r=65535&(e|=0);return n*r+((t>>>16)*r+n*(e>>>16)<<16>>>0)|0};function xt(t){return t>>>1&1073741824|3221225471&t}function Ot(t){if(!1===t||null==t)return 0;if("function"==typeof t.valueOf&&(!1===(t=t.valueOf())||null==t))return 0;if(!0===t)return 1;var e=typeof t;if("number"===e){if(t!=t||t===1/0)return 0;var n=0|t;for(n!==t&&(n^=4294967295*t);t>4294967295;)n^=t/=4294967295;return xt(n)}if("string"===e)return t.length>Ft?Mt(t):Nt(t);if("function"==typeof t.hashCode)return t.hashCode();if("object"===e)return Ct(t);if("function"==typeof t.toString)return Nt(t.toString());throw new Error("Value type "+e+" cannot be hashed.")}function Mt(t){var e=Gt[t];return void 0===e&&(e=Nt(t),Vt===zt&&(Vt=0,Gt={}),Vt++,Gt[t]=e),e}function Nt(t){for(var e=0,n=0;n<t.length;n++)e=31*e+t.charCodeAt(n)|0;return xt(e)}function Ct(t){var e;if(Bt&&void 0!==(e=Lt.get(t)))return e;if(void 0!==(e=t[jt]))return e;if(!Dt){if(void 0!==(e=t.propertyIsEnumerable&&t.propertyIsEnumerable[jt]))return e;if(void 0!==(e=Pt(t)))return e}if(e=++Ut,1073741824&Ut&&(Ut=0),Bt)Lt.set(t,e);else{if(void 0!==Rt&&!1===Rt(t))throw new Error("Non-extensible objects are not allowed as keys.");if(Dt)Object.defineProperty(t,jt,{enumerable:!1,configurable:!1,writable:!1,value:e});else if(void 0!==t.propertyIsEnumerable&&t.propertyIsEnumerable===t.constructor.prototype.propertyIsEnumerable)t.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},t.propertyIsEnumerable[jt]=e;else{if(void 0===t.nodeType)throw new Error("Unable to set a non-enumerable property on object.");t[jt]=e}}return e}var Rt=Object.isExtensible,Dt=function(){try{return Object.defineProperty({},"@",{}),!0}catch(t){return!1}}();function Pt(t){if(t&&t.nodeType>0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}var Lt,Bt="function"==typeof WeakMap;Bt&&(Lt=new WeakMap);var Ut=0,jt="__immutablehash__";"function"==typeof Symbol&&(jt=Symbol(jt));var Ft=16,zt=255,Vt=0,Gt={};function Yt(t){wt(t!==1/0,"Cannot perform this action with an infinite size.")}function Ht(t){return null==t?ie():Wt(t)&&!l(t)?t:ie().withMutations((function(e){var n=r(t);Yt(n.size),n.forEach((function(t,n){return e.set(n,t)}))}))}function Wt(t){return!(!t||!t[qt])}e(Ht,At),Ht.of=function(){var e=t.call(arguments,0);return ie().withMutations((function(t){for(var n=0;n<e.length;n+=2){if(n+1>=e.length)throw new Error("Missing value for key: "+e[n]);t.set(e[n],e[n+1])}}))},Ht.prototype.toString=function(){return this.__toString("Map {","}")},Ht.prototype.get=function(t,e){return this._root?this._root.get(0,void 0,t,e):e},Ht.prototype.set=function(t,e){return se(this,t,e)},Ht.prototype.setIn=function(t,e){return this.updateIn(t,v,(function(){return e}))},Ht.prototype.remove=function(t){return se(this,t,v)},Ht.prototype.deleteIn=function(t){return this.updateIn(t,(function(){return v}))},Ht.prototype.update=function(t,e,n){return 1===arguments.length?t(this):this.updateIn([t],e,n)},Ht.prototype.updateIn=function(t,e,n){n||(n=e,e=void 0);var r=ge(this,En(t),e,n);return r===v?void 0:r},Ht.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):ie()},Ht.prototype.merge=function(){return de(this,void 0,arguments)},Ht.prototype.mergeWith=function(e){return de(this,e,t.call(arguments,1))},Ht.prototype.mergeIn=function(e){var n=t.call(arguments,1);return this.updateIn(e,ie(),(function(t){return"function"==typeof t.merge?t.merge.apply(t,n):n[n.length-1]}))},Ht.prototype.mergeDeep=function(){return de(this,pe,arguments)},Ht.prototype.mergeDeepWith=function(e){var n=t.call(arguments,1);return de(this,fe(e),n)},Ht.prototype.mergeDeepIn=function(e){var n=t.call(arguments,1);return this.updateIn(e,ie(),(function(t){return"function"==typeof t.mergeDeep?t.mergeDeep.apply(t,n):n[n.length-1]}))},Ht.prototype.sort=function(t){return Ge(hn(this,t))},Ht.prototype.sortBy=function(t,e){return Ge(hn(this,e,t))},Ht.prototype.withMutations=function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},Ht.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new k)},Ht.prototype.asImmutable=function(){return this.__ensureOwner()},Ht.prototype.wasAltered=function(){return this.__altered},Ht.prototype.__iterator=function(t,e){return new te(this,t,e)},Ht.prototype.__iterate=function(t,e){var n=this,r=0;return this._root&&this._root.iterate((function(e){return r++,t(e[1],e[0],n)}),e),r},Ht.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?re(this.size,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},Ht.isMap=Wt;var Kt,qt="@@__IMMUTABLE_MAP__@@",Qt=Ht.prototype;function Xt(t,e){this.ownerID=t,this.entries=e}function Zt(t,e,n){this.ownerID=t,this.bitmap=e,this.nodes=n}function Jt(t,e,n){this.ownerID=t,this.count=e,this.nodes=n}function _t(t,e,n){this.ownerID=t,this.keyHash=e,this.entries=n}function $t(t,e,n){this.ownerID=t,this.keyHash=e,this.entry=n}function te(t,e,n){this._type=e,this._reverse=n,this._stack=t._root&&ne(t._root)}function ee(t,e){return z(t,e[0],e[1])}function ne(t,e){return{node:t,index:0,__prev:e}}function re(t,e,n,r){var i=Object.create(Qt);return i.size=t,i._root=e,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function ie(){return Kt||(Kt=re(0))}function se(t,e,n){var r,i;if(t._root){var s=E(w),o=E(T);if(r=oe(t._root,t.__ownerID,0,void 0,e,n,s,o),!o.value)return t;i=t.size+(s.value?n===v?-1:1:0)}else{if(n===v)return t;i=1,r=new Xt(t.__ownerID,[[e,n]])}return t.__ownerID?(t.size=i,t._root=r,t.__hash=void 0,t.__altered=!0,t):r?re(i,r):ie()}function oe(t,e,n,r,i,s,o,a){return t?t.update(e,n,r,i,s,o,a):s===v?t:(A(a),A(o),new $t(e,r,[i,s]))}function ae(t){return t.constructor===$t||t.constructor===_t}function ce(t,e,n,r,i){if(t.keyHash===r)return new _t(e,r,[t.entry,i]);var s,o=(0===n?t.keyHash:t.keyHash>>>n)&y,a=(0===n?r:r>>>n)&y;return new Zt(e,1<<o|1<<a,o===a?[ce(t,e,n+g,r,i)]:(s=new $t(e,r,i),o<a?[t,s]:[s,t]))}function ue(t,e,n,r){t||(t=new k);for(var i=new $t(t,Ot(n),[n,r]),s=0;s<e.length;s++){var o=e[s];i=i.update(t,0,void 0,o[0],o[1])}return i}function le(t,e,n,r){for(var i=0,s=0,o=new Array(n),a=0,c=1,u=e.length;a<u;a++,c<<=1){var l=e[a];void 0!==l&&a!==r&&(i|=c,o[s++]=l)}return new Zt(t,i,o)}function he(t,e,n,r,i){for(var s=0,o=new Array(b),a=0;0!==n;a++,n>>>=1)o[a]=1&n?e[s++]:void 0;return o[r]=i,new Jt(t,s+1,o)}function de(t,e,n){for(var i=[],s=0;s<n.length;s++){var a=n[s],c=r(a);o(a)||(c=c.map((function(t){return pt(t)}))),i.push(c)}return me(t,e,i)}function pe(t,e,n){return t&&t.mergeDeep&&o(e)?t.mergeDeep(e):bt(t,e)?t:e}function fe(t){return function(e,n,r){if(e&&e.mergeDeepWith&&o(n))return e.mergeDeepWith(t,n);var i=t(e,n,r);return bt(e,i)?e:i}}function me(t,e,n){return 0===(n=n.filter((function(t){return 0!==t.size}))).length?t:0!==t.size||t.__ownerID||1!==n.length?t.withMutations((function(t){for(var r=e?function(n,r){t.update(r,v,(function(t){return t===v?n:e(t,n,r)}))}:function(e,n){t.set(n,e)},i=0;i<n.length;i++)n[i].forEach(r)})):t.constructor(n[0])}function ge(t,e,n,r){var i=t===v,s=e.next();if(s.done){var o=i?n:t,a=r(o);return a===o?t:a}wt(i||t&&t.set,"invalid keyPath");var c=s.value,u=i?v:t.get(c,v),l=ge(u,e,n,r);return l===u?t:l===v?t.remove(c):(i?ie():t).set(c,l)}function be(t){return t=(t=(858993459&(t-=t>>1&1431655765))+(t>>2&858993459))+(t>>4)&252645135,t+=t>>8,127&(t+=t>>16)}function ye(t,e,n,r){var i=r?t:I(t);return i[e]=n,i}function ve(t,e,n,r){var i=t.length+1;if(r&&e+1===i)return t[e]=n,t;for(var s=new Array(i),o=0,a=0;a<i;a++)a===e?(s[a]=n,o=-1):s[a]=t[a+o];return s}function we(t,e,n){var r=t.length-1;if(n&&e===r)return t.pop(),t;for(var i=new Array(r),s=0,o=0;o<r;o++)o===e&&(s=1),i[o]=t[o+s];return i}Qt[qt]=!0,Qt[m]=Qt.remove,Qt.removeIn=Qt.deleteIn,Xt.prototype.get=function(t,e,n,r){for(var i=this.entries,s=0,o=i.length;s<o;s++)if(bt(n,i[s][0]))return i[s][1];return r},Xt.prototype.update=function(t,e,n,r,i,s,o){for(var a=i===v,c=this.entries,u=0,l=c.length;u<l&&!bt(r,c[u][0]);u++);var h=u<l;if(h?c[u][1]===i:a)return this;if(A(o),(a||!h)&&A(s),!a||1!==c.length){if(!h&&!a&&c.length>=Te)return ue(t,c,r,i);var d=t&&t===this.ownerID,p=d?c:I(c);return h?a?u===l-1?p.pop():p[u]=p.pop():p[u]=[r,i]:p.push([r,i]),d?(this.entries=p,this):new Xt(t,p)}},Zt.prototype.get=function(t,e,n,r){void 0===e&&(e=Ot(n));var i=1<<((0===t?e:e>>>t)&y),s=this.bitmap;return s&i?this.nodes[be(s&i-1)].get(t+g,e,n,r):r},Zt.prototype.update=function(t,e,n,r,i,s,o){void 0===n&&(n=Ot(r));var a=(0===e?n:n>>>e)&y,c=1<<a,u=this.bitmap,l=!!(u&c);if(!l&&i===v)return this;var h=be(u&c-1),d=this.nodes,p=l?d[h]:void 0,f=oe(p,t,e+g,n,r,i,s,o);if(f===p)return this;if(!l&&f&&d.length>=Ee)return he(t,d,u,a,f);if(l&&!f&&2===d.length&&ae(d[1^h]))return d[1^h];if(l&&f&&1===d.length&&ae(f))return f;var m=t&&t===this.ownerID,b=l?f?u:u^c:u|c,w=l?f?ye(d,h,f,m):we(d,h,m):ve(d,h,f,m);return m?(this.bitmap=b,this.nodes=w,this):new Zt(t,b,w)},Jt.prototype.get=function(t,e,n,r){void 0===e&&(e=Ot(n));var i=(0===t?e:e>>>t)&y,s=this.nodes[i];return s?s.get(t+g,e,n,r):r},Jt.prototype.update=function(t,e,n,r,i,s,o){void 0===n&&(n=Ot(r));var a=(0===e?n:n>>>e)&y,c=i===v,u=this.nodes,l=u[a];if(c&&!l)return this;var h=oe(l,t,e+g,n,r,i,s,o);if(h===l)return this;var d=this.count;if(l){if(!h&&--d<Ae)return le(t,u,d,a)}else d++;var p=t&&t===this.ownerID,f=ye(u,a,h,p);return p?(this.count=d,this.nodes=f,this):new Jt(t,d,f)},_t.prototype.get=function(t,e,n,r){for(var i=this.entries,s=0,o=i.length;s<o;s++)if(bt(n,i[s][0]))return i[s][1];return r},_t.prototype.update=function(t,e,n,r,i,s,o){void 0===n&&(n=Ot(r));var a=i===v;if(n!==this.keyHash)return a?this:(A(o),A(s),ce(this,t,e,n,[r,i]));for(var c=this.entries,u=0,l=c.length;u<l&&!bt(r,c[u][0]);u++);var h=u<l;if(h?c[u][1]===i:a)return this;if(A(o),(a||!h)&&A(s),a&&2===l)return new $t(t,this.keyHash,c[1^u]);var d=t&&t===this.ownerID,p=d?c:I(c);return h?a?u===l-1?p.pop():p[u]=p.pop():p[u]=[r,i]:p.push([r,i]),d?(this.entries=p,this):new _t(t,this.keyHash,p)},$t.prototype.get=function(t,e,n,r){return bt(n,this.entry[0])?this.entry[1]:r},$t.prototype.update=function(t,e,n,r,i,s,o){var a=i===v,c=bt(r,this.entry[0]);return(c?i===this.entry[1]:a)?this:(A(o),a?void A(s):c?t&&t===this.ownerID?(this.entry[1]=i,this):new $t(t,this.keyHash,[r,i]):(A(s),ce(this,t,e,Ot(r),[r,i])))},Xt.prototype.iterate=_t.prototype.iterate=function(t,e){for(var n=this.entries,r=0,i=n.length-1;r<=i;r++)if(!1===t(n[e?i-r:r]))return!1},Zt.prototype.iterate=Jt.prototype.iterate=function(t,e){for(var n=this.nodes,r=0,i=n.length-1;r<=i;r++){var s=n[e?i-r:r];if(s&&!1===s.iterate(t,e))return!1}},$t.prototype.iterate=function(t,e){return t(this.entry)},e(te,F),te.prototype.next=function(){for(var t=this._type,e=this._stack;e;){var n,r=e.node,i=e.index++;if(r.entry){if(0===i)return ee(t,r.entry)}else if(r.entries){if(i<=(n=r.entries.length-1))return ee(t,r.entries[this._reverse?n-i:i])}else if(i<=(n=r.nodes.length-1)){var s=r.nodes[this._reverse?n-i:i];if(s){if(s.entry)return ee(t,s.entry);e=this._stack=ne(s,e)}continue}e=this._stack=this._stack.__prev}return V()};var Te=b/4,Ee=b/2,Ae=b/4;function ke(t){var e=Pe();if(null==t)return e;if(Ie(t))return t;var n=i(t),r=n.size;return 0===r?e:(Yt(r),r>0&&r<b?De(0,r,g,null,new Oe(n.toArray())):e.withMutations((function(t){t.setSize(r),n.forEach((function(e,n){return t.set(n,e)}))})))}function Ie(t){return!(!t||!t[Se])}e(ke,kt),ke.of=function(){return this(arguments)},ke.prototype.toString=function(){return this.__toString("List [","]")},ke.prototype.get=function(t,e){if((t=x(this,t))>=0&&t<this.size){var n=je(this,t+=this._origin);return n&&n.array[t&y]}return e},ke.prototype.set=function(t,e){return Le(this,t,e)},ke.prototype.remove=function(t){return this.has(t)?0===t?this.shift():t===this.size-1?this.pop():this.splice(t,1):this},ke.prototype.insert=function(t,e){return this.splice(t,0,e)},ke.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=g,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):Pe()},ke.prototype.push=function(){var t=arguments,e=this.size;return this.withMutations((function(n){Fe(n,0,e+t.length);for(var r=0;r<t.length;r++)n.set(e+r,t[r])}))},ke.prototype.pop=function(){return Fe(this,0,-1)},ke.prototype.unshift=function(){var t=arguments;return this.withMutations((function(e){Fe(e,-t.length);for(var n=0;n<t.length;n++)e.set(n,t[n])}))},ke.prototype.shift=function(){return Fe(this,1)},ke.prototype.merge=function(){return ze(this,void 0,arguments)},ke.prototype.mergeWith=function(e){return ze(this,e,t.call(arguments,1))},ke.prototype.mergeDeep=function(){return ze(this,pe,arguments)},ke.prototype.mergeDeepWith=function(e){var n=t.call(arguments,1);return ze(this,fe(e),n)},ke.prototype.setSize=function(t){return Fe(this,0,t)},ke.prototype.slice=function(t,e){var n=this.size;return M(t,e,n)?this:Fe(this,N(t,n),C(e,n))},ke.prototype.__iterator=function(t,e){var n=0,r=Re(this,e);return new F((function(){var e=r();return e===Ce?V():z(t,n++,e)}))},ke.prototype.__iterate=function(t,e){for(var n,r=0,i=Re(this,e);(n=i())!==Ce&&!1!==t(n,r++,this););return r},ke.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?De(this._origin,this._capacity,this._level,this._root,this._tail,t,this.__hash):(this.__ownerID=t,this)},ke.isList=Ie;var Se="@@__IMMUTABLE_LIST__@@",xe=ke.prototype;function Oe(t,e){this.array=t,this.ownerID=e}xe[Se]=!0,xe[m]=xe.remove,xe.setIn=Qt.setIn,xe.deleteIn=xe.removeIn=Qt.removeIn,xe.update=Qt.update,xe.updateIn=Qt.updateIn,xe.mergeIn=Qt.mergeIn,xe.mergeDeepIn=Qt.mergeDeepIn,xe.withMutations=Qt.withMutations,xe.asMutable=Qt.asMutable,xe.asImmutable=Qt.asImmutable,xe.wasAltered=Qt.wasAltered,Oe.prototype.removeBefore=function(t,e,n){if(n===e?1<<e:0===this.array.length)return this;var r=n>>>e&y;if(r>=this.array.length)return new Oe([],t);var i,s=0===r;if(e>0){var o=this.array[r];if((i=o&&o.removeBefore(t,e-g,n))===o&&s)return this}if(s&&!i)return this;var a=Ue(this,t);if(!s)for(var c=0;c<r;c++)a.array[c]=void 0;return i&&(a.array[r]=i),a},Oe.prototype.removeAfter=function(t,e,n){if(n===(e?1<<e:0)||0===this.array.length)return this;var r,i=n-1>>>e&y;if(i>=this.array.length)return this;if(e>0){var s=this.array[i];if((r=s&&s.removeAfter(t,e-g,n))===s&&i===this.array.length-1)return this}var o=Ue(this,t);return o.array.splice(i+1),r&&(o.array[i]=r),o};var Me,Ne,Ce={};function Re(t,e){var n=t._origin,r=t._capacity,i=Ve(r),s=t._tail;return o(t._root,t._level,0);function o(t,e,n){return 0===e?a(t,n):c(t,e,n)}function a(t,o){var a=o===i?s&&s.array:t&&t.array,c=o>n?0:n-o,u=r-o;return u>b&&(u=b),function(){if(c===u)return Ce;var t=e?--u:c++;return a&&a[t]}}function c(t,i,s){var a,c=t&&t.array,u=s>n?0:n-s>>i,l=1+(r-s>>i);return l>b&&(l=b),function(){for(;;){if(a){var t=a();if(t!==Ce)return t;a=null}if(u===l)return Ce;var n=e?--l:u++;a=o(c&&c[n],i-g,s+(n<<i))}}}}function De(t,e,n,r,i,s,o){var a=Object.create(xe);return a.size=e-t,a._origin=t,a._capacity=e,a._level=n,a._root=r,a._tail=i,a.__ownerID=s,a.__hash=o,a.__altered=!1,a}function Pe(){return Me||(Me=De(0,0,g))}function Le(t,e,n){if((e=x(t,e))!=e)return t;if(e>=t.size||e<0)return t.withMutations((function(t){e<0?Fe(t,e).set(0,n):Fe(t,0,e+1).set(e,n)}));e+=t._origin;var r=t._tail,i=t._root,s=E(T);return e>=Ve(t._capacity)?r=Be(r,t.__ownerID,0,e,n,s):i=Be(i,t.__ownerID,t._level,e,n,s),s.value?t.__ownerID?(t._root=i,t._tail=r,t.__hash=void 0,t.__altered=!0,t):De(t._origin,t._capacity,t._level,i,r):t}function Be(t,e,n,r,i,s){var o,a=r>>>n&y,c=t&&a<t.array.length;if(!c&&void 0===i)return t;if(n>0){var u=t&&t.array[a],l=Be(u,e,n-g,r,i,s);return l===u?t:((o=Ue(t,e)).array[a]=l,o)}return c&&t.array[a]===i?t:(A(s),o=Ue(t,e),void 0===i&&a===o.array.length-1?o.array.pop():o.array[a]=i,o)}function Ue(t,e){return e&&t&&e===t.ownerID?t:new Oe(t?t.array.slice():[],e)}function je(t,e){if(e>=Ve(t._capacity))return t._tail;if(e<1<<t._level+g){for(var n=t._root,r=t._level;n&&r>0;)n=n.array[e>>>r&y],r-=g;return n}}function Fe(t,e,n){void 0!==e&&(e|=0),void 0!==n&&(n|=0);var r=t.__ownerID||new k,i=t._origin,s=t._capacity,o=i+e,a=void 0===n?s:n<0?s+n:i+n;if(o===i&&a===s)return t;if(o>=a)return t.clear();for(var c=t._level,u=t._root,l=0;o+l<0;)u=new Oe(u&&u.array.length?[void 0,u]:[],r),l+=1<<(c+=g);l&&(o+=l,i+=l,a+=l,s+=l);for(var h=Ve(s),d=Ve(a);d>=1<<c+g;)u=new Oe(u&&u.array.length?[u]:[],r),c+=g;var p=t._tail,f=d<h?je(t,a-1):d>h?new Oe([],r):p;if(p&&d>h&&o<s&&p.array.length){for(var m=u=Ue(u,r),b=c;b>g;b-=g){var v=h>>>b&y;m=m.array[v]=Ue(m.array[v],r)}m.array[h>>>g&y]=p}if(a<s&&(f=f&&f.removeAfter(r,0,a)),o>=d)o-=d,a-=d,c=g,u=null,f=f&&f.removeBefore(r,0,o);else if(o>i||d<h){for(l=0;u;){var w=o>>>c&y;if(w!==d>>>c&y)break;w&&(l+=(1<<c)*w),c-=g,u=u.array[w]}u&&o>i&&(u=u.removeBefore(r,c,o-l)),u&&d<h&&(u=u.removeAfter(r,c,d-l)),l&&(o-=l,a-=l)}return t.__ownerID?(t.size=a-o,t._origin=o,t._capacity=a,t._level=c,t._root=u,t._tail=f,t.__hash=void 0,t.__altered=!0,t):De(o,a,c,u,f)}function ze(t,e,n){for(var r=[],s=0,a=0;a<n.length;a++){var c=n[a],u=i(c);u.size>s&&(s=u.size),o(c)||(u=u.map((function(t){return pt(t)}))),r.push(u)}return s>t.size&&(t=t.setSize(s)),me(t,e,r)}function Ve(t){return t<b?0:t-1>>>g<<g}function Ge(t){return null==t?We():Ye(t)?t:We().withMutations((function(e){var n=r(t);Yt(n.size),n.forEach((function(t,n){return e.set(n,t)}))}))}function Ye(t){return Wt(t)&&l(t)}function He(t,e,n,r){var i=Object.create(Ge.prototype);return i.size=t?t.size:0,i._map=t,i._list=e,i.__ownerID=n,i.__hash=r,i}function We(){return Ne||(Ne=He(ie(),Pe()))}function Ke(t,e,n){var r,i,s=t._map,o=t._list,a=s.get(e),c=void 0!==a;if(n===v){if(!c)return t;o.size>=b&&o.size>=2*s.size?(r=(i=o.filter((function(t,e){return void 0!==t&&a!==e}))).toKeyedSeq().map((function(t){return t[0]})).flip().toMap(),t.__ownerID&&(r.__ownerID=i.__ownerID=t.__ownerID)):(r=s.remove(e),i=a===o.size-1?o.pop():o.set(a,void 0))}else if(c){if(n===o.get(a)[1])return t;r=s,i=o.set(a,[e,n])}else r=s.set(e,o.size),i=o.set(o.size,[e,n]);return t.__ownerID?(t.size=r.size,t._map=r,t._list=i,t.__hash=void 0,t):He(r,i)}function qe(t,e){this._iter=t,this._useKeys=e,this.size=t.size}function Qe(t){this._iter=t,this.size=t.size}function Xe(t){this._iter=t,this.size=t.size}function Ze(t){this._iter=t,this.size=t.size}function Je(t){var e=vn(t);return e._iter=t,e.size=t.size,e.flip=function(){return t},e.reverse=function(){var e=t.reverse.apply(this);return e.flip=function(){return t.reverse()},e},e.has=function(e){return t.includes(e)},e.includes=function(e){return t.has(e)},e.cacheResult=wn,e.__iterateUncached=function(e,n){var r=this;return t.__iterate((function(t,n){return!1!==e(n,t,r)}),n)},e.__iteratorUncached=function(e,n){if(e===L){var r=t.__iterator(e,n);return new F((function(){var t=r.next();if(!t.done){var e=t.value[0];t.value[0]=t.value[1],t.value[1]=e}return t}))}return t.__iterator(e===P?D:P,n)},e}function _e(t,e,n){var r=vn(t);return r.size=t.size,r.has=function(e){return t.has(e)},r.get=function(r,i){var s=t.get(r,v);return s===v?i:e.call(n,s,r,t)},r.__iterateUncached=function(r,i){var s=this;return t.__iterate((function(t,i,o){return!1!==r(e.call(n,t,i,o),i,s)}),i)},r.__iteratorUncached=function(r,i){var s=t.__iterator(L,i);return new F((function(){var i=s.next();if(i.done)return i;var o=i.value,a=o[0];return z(r,a,e.call(n,o[1],a,t),i)}))},r}function $e(t,e){var n=vn(t);return n._iter=t,n.size=t.size,n.reverse=function(){return t},t.flip&&(n.flip=function(){var e=Je(t);return e.reverse=function(){return t.flip()},e}),n.get=function(n,r){return t.get(e?n:-1-n,r)},n.has=function(n){return t.has(e?n:-1-n)},n.includes=function(e){return t.includes(e)},n.cacheResult=wn,n.__iterate=function(e,n){var r=this;return t.__iterate((function(t,n){return e(t,n,r)}),!n)},n.__iterator=function(e,n){return t.__iterator(e,!n)},n}function tn(t,e,n,r){var i=vn(t);return r&&(i.has=function(r){var i=t.get(r,v);return i!==v&&!!e.call(n,i,r,t)},i.get=function(r,i){var s=t.get(r,v);return s!==v&&e.call(n,s,r,t)?s:i}),i.__iterateUncached=function(i,s){var o=this,a=0;return t.__iterate((function(t,s,c){if(e.call(n,t,s,c))return a++,i(t,r?s:a-1,o)}),s),a},i.__iteratorUncached=function(i,s){var o=t.__iterator(L,s),a=0;return new F((function(){for(;;){var s=o.next();if(s.done)return s;var c=s.value,u=c[0],l=c[1];if(e.call(n,l,u,t))return z(i,r?u:a++,l,s)}}))},i}function en(t,e,n){var r=Ht().asMutable();return t.__iterate((function(i,s){r.update(e.call(n,i,s,t),0,(function(t){return t+1}))})),r.asImmutable()}function nn(t,e,n){var r=a(t),i=(l(t)?Ge():Ht()).asMutable();t.__iterate((function(s,o){i.update(e.call(n,s,o,t),(function(t){return(t=t||[]).push(r?[o,s]:s),t}))}));var s=yn(t);return i.map((function(e){return mn(t,s(e))}))}function rn(t,e,n,r){var i=t.size;if(void 0!==e&&(e|=0),void 0!==n&&(n===1/0?n=i:n|=0),M(e,n,i))return t;var s=N(e,i),o=C(n,i);if(s!=s||o!=o)return rn(t.toSeq().cacheResult(),e,n,r);var a,c=o-s;c==c&&(a=c<0?0:c);var u=vn(t);return u.size=0===a?a:t.size&&a||void 0,!r&&st(t)&&a>=0&&(u.get=function(e,n){return(e=x(this,e))>=0&&e<a?t.get(e+s,n):n}),u.__iterateUncached=function(e,n){var i=this;if(0===a)return 0;if(n)return this.cacheResult().__iterate(e,n);var o=0,c=!0,u=0;return t.__iterate((function(t,n){if(!c||!(c=o++<s))return u++,!1!==e(t,r?n:u-1,i)&&u!==a})),u},u.__iteratorUncached=function(e,n){if(0!==a&&n)return this.cacheResult().__iterator(e,n);var i=0!==a&&t.__iterator(e,n),o=0,c=0;return new F((function(){for(;o++<s;)i.next();if(++c>a)return V();var t=i.next();return r||e===P?t:z(e,c-1,e===D?void 0:t.value[1],t)}))},u}function sn(t,e,n){var r=vn(t);return r.__iterateUncached=function(r,i){var s=this;if(i)return this.cacheResult().__iterate(r,i);var o=0;return t.__iterate((function(t,i,a){return e.call(n,t,i,a)&&++o&&r(t,i,s)})),o},r.__iteratorUncached=function(r,i){var s=this;if(i)return this.cacheResult().__iterator(r,i);var o=t.__iterator(L,i),a=!0;return new F((function(){if(!a)return V();var t=o.next();if(t.done)return t;var i=t.value,c=i[0],u=i[1];return e.call(n,u,c,s)?r===L?t:z(r,c,u,t):(a=!1,V())}))},r}function on(t,e,n,r){var i=vn(t);return i.__iterateUncached=function(i,s){var o=this;if(s)return this.cacheResult().__iterate(i,s);var a=!0,c=0;return t.__iterate((function(t,s,u){if(!a||!(a=e.call(n,t,s,u)))return c++,i(t,r?s:c-1,o)})),c},i.__iteratorUncached=function(i,s){var o=this;if(s)return this.cacheResult().__iterator(i,s);var a=t.__iterator(L,s),c=!0,u=0;return new F((function(){var t,s,l;do{if((t=a.next()).done)return r||i===P?t:z(i,u++,i===D?void 0:t.value[1],t);var h=t.value;s=h[0],l=h[1],c&&(c=e.call(n,l,s,o))}while(c);return i===L?t:z(i,s,l,t)}))},i}function an(t,e){var n=a(t),i=[t].concat(e).map((function(t){return o(t)?n&&(t=r(t)):t=n?at(t):ct(Array.isArray(t)?t:[t]),t})).filter((function(t){return 0!==t.size}));if(0===i.length)return t;if(1===i.length){var s=i[0];if(s===t||n&&a(s)||c(t)&&c(s))return s}var u=new et(i);return n?u=u.toKeyedSeq():c(t)||(u=u.toSetSeq()),(u=u.flatten(!0)).size=i.reduce((function(t,e){if(void 0!==t){var n=e.size;if(void 0!==n)return t+n}}),0),u}function cn(t,e,n){var r=vn(t);return r.__iterateUncached=function(r,i){var s=0,a=!1;function c(t,u){var l=this;t.__iterate((function(t,i){return(!e||u<e)&&o(t)?c(t,u+1):!1===r(t,n?i:s++,l)&&(a=!0),!a}),i)}return c(t,0),s},r.__iteratorUncached=function(r,i){var s=t.__iterator(r,i),a=[],c=0;return new F((function(){for(;s;){var t=s.next();if(!1===t.done){var u=t.value;if(r===L&&(u=u[1]),e&&!(a.length<e)||!o(u))return n?t:z(r,c++,u,t);a.push(s),s=u.__iterator(r,i)}else s=a.pop()}return V()}))},r}function un(t,e,n){var r=yn(t);return t.toSeq().map((function(i,s){return r(e.call(n,i,s,t))})).flatten(!0)}function ln(t,e){var n=vn(t);return n.size=t.size&&2*t.size-1,n.__iterateUncached=function(n,r){var i=this,s=0;return t.__iterate((function(t,r){return(!s||!1!==n(e,s++,i))&&!1!==n(t,s++,i)}),r),s},n.__iteratorUncached=function(n,r){var i,s=t.__iterator(P,r),o=0;return new F((function(){return(!i||o%2)&&(i=s.next()).done?i:o%2?z(n,o++,e):z(n,o++,i.value,i)}))},n}function hn(t,e,n){e||(e=Tn);var r=a(t),i=0,s=t.toSeq().map((function(e,r){return[r,e,i++,n?n(e,r,t):e]})).toArray();return s.sort((function(t,n){return e(t[3],n[3])||t[2]-n[2]})).forEach(r?function(t,e){s[e].length=2}:function(t,e){s[e]=t[1]}),r?Q(s):c(t)?X(s):Z(s)}function dn(t,e,n){if(e||(e=Tn),n){var r=t.toSeq().map((function(e,r){return[e,n(e,r,t)]})).reduce((function(t,n){return pn(e,t[1],n[1])?n:t}));return r&&r[0]}return t.reduce((function(t,n){return pn(e,t,n)?n:t}))}function pn(t,e,n){var r=t(n,e);return 0===r&&n!==e&&(null==n||n!=n)||r>0}function fn(t,e,r){var i=vn(t);return i.size=new et(r).map((function(t){return t.size})).min(),i.__iterate=function(t,e){for(var n,r=this.__iterator(P,e),i=0;!(n=r.next()).done&&!1!==t(n.value,i++,this););return i},i.__iteratorUncached=function(t,i){var s=r.map((function(t){return t=n(t),H(i?t.reverse():t)})),o=0,a=!1;return new F((function(){var n;return a||(n=s.map((function(t){return t.next()})),a=n.some((function(t){return t.done}))),a?V():z(t,o++,e.apply(null,n.map((function(t){return t.value}))))}))},i}function mn(t,e){return st(t)?e:t.constructor(e)}function gn(t){if(t!==Object(t))throw new TypeError("Expected [K, V] tuple: "+t)}function bn(t){return Yt(t.size),S(t)}function yn(t){return a(t)?r:c(t)?i:s}function vn(t){return Object.create((a(t)?Q:c(t)?X:Z).prototype)}function wn(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):q.prototype.cacheResult.call(this)}function Tn(t,e){return t>e?1:t<e?-1:0}function En(t){var e=H(t);if(!e){if(!K(t))throw new TypeError("Expected iterable or array-like: "+t);e=H(n(t))}return e}function An(t,e){var n,r=function(s){if(s instanceof r)return s;if(!(this instanceof r))return new r(s);if(!n){n=!0;var o=Object.keys(t);xn(i,o),i.size=o.length,i._name=e,i._keys=o,i._defaultValues=t}this._map=Ht(s)},i=r.prototype=Object.create(kn);return i.constructor=r,r}e(Ge,Ht),Ge.of=function(){return this(arguments)},Ge.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Ge.prototype.get=function(t,e){var n=this._map.get(t);return void 0!==n?this._list.get(n)[1]:e},Ge.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):We()},Ge.prototype.set=function(t,e){return Ke(this,t,e)},Ge.prototype.remove=function(t){return Ke(this,t,v)},Ge.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Ge.prototype.__iterate=function(t,e){var n=this;return this._list.__iterate((function(e){return e&&t(e[1],e[0],n)}),e)},Ge.prototype.__iterator=function(t,e){return this._list.fromEntrySeq().__iterator(t,e)},Ge.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),n=this._list.__ensureOwner(t);return t?He(e,n,t,this.__hash):(this.__ownerID=t,this._map=e,this._list=n,this)},Ge.isOrderedMap=Ye,Ge.prototype[f]=!0,Ge.prototype[m]=Ge.prototype.remove,e(qe,Q),qe.prototype.get=function(t,e){return this._iter.get(t,e)},qe.prototype.has=function(t){return this._iter.has(t)},qe.prototype.valueSeq=function(){return this._iter.valueSeq()},qe.prototype.reverse=function(){var t=this,e=$e(this,!0);return this._useKeys||(e.valueSeq=function(){return t._iter.toSeq().reverse()}),e},qe.prototype.map=function(t,e){var n=this,r=_e(this,t,e);return this._useKeys||(r.valueSeq=function(){return n._iter.toSeq().map(t,e)}),r},qe.prototype.__iterate=function(t,e){var n,r=this;return this._iter.__iterate(this._useKeys?function(e,n){return t(e,n,r)}:(n=e?bn(this):0,function(i){return t(i,e?--n:n++,r)}),e)},qe.prototype.__iterator=function(t,e){if(this._useKeys)return this._iter.__iterator(t,e);var n=this._iter.__iterator(P,e),r=e?bn(this):0;return new F((function(){var i=n.next();return i.done?i:z(t,e?--r:r++,i.value,i)}))},qe.prototype[f]=!0,e(Qe,X),Qe.prototype.includes=function(t){return this._iter.includes(t)},Qe.prototype.__iterate=function(t,e){var n=this,r=0;return this._iter.__iterate((function(e){return t(e,r++,n)}),e)},Qe.prototype.__iterator=function(t,e){var n=this._iter.__iterator(P,e),r=0;return new F((function(){var e=n.next();return e.done?e:z(t,r++,e.value,e)}))},e(Xe,Z),Xe.prototype.has=function(t){return this._iter.includes(t)},Xe.prototype.__iterate=function(t,e){var n=this;return this._iter.__iterate((function(e){return t(e,e,n)}),e)},Xe.prototype.__iterator=function(t,e){var n=this._iter.__iterator(P,e);return new F((function(){var e=n.next();return e.done?e:z(t,e.value,e.value,e)}))},e(Ze,Q),Ze.prototype.entrySeq=function(){return this._iter.toSeq()},Ze.prototype.__iterate=function(t,e){var n=this;return this._iter.__iterate((function(e){if(e){gn(e);var r=o(e);return t(r?e.get(1):e[1],r?e.get(0):e[0],n)}}),e)},Ze.prototype.__iterator=function(t,e){var n=this._iter.__iterator(P,e);return new F((function(){for(;;){var e=n.next();if(e.done)return e;var r=e.value;if(r){gn(r);var i=o(r);return z(t,i?r.get(0):r[0],i?r.get(1):r[1],e)}}}))},Qe.prototype.cacheResult=qe.prototype.cacheResult=Xe.prototype.cacheResult=Ze.prototype.cacheResult=wn,e(An,At),An.prototype.toString=function(){return this.__toString(Sn(this)+" {","}")},An.prototype.has=function(t){return this._defaultValues.hasOwnProperty(t)},An.prototype.get=function(t,e){if(!this.has(t))return e;var n=this._defaultValues[t];return this._map?this._map.get(t,n):n},An.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var t=this.constructor;return t._empty||(t._empty=In(this,ie()))},An.prototype.set=function(t,e){if(!this.has(t))throw new Error('Cannot set unknown key "'+t+'" on '+Sn(this));if(this._map&&!this._map.has(t)&&e===this._defaultValues[t])return this;var n=this._map&&this._map.set(t,e);return this.__ownerID||n===this._map?this:In(this,n)},An.prototype.remove=function(t){if(!this.has(t))return this;var e=this._map&&this._map.remove(t);return this.__ownerID||e===this._map?this:In(this,e)},An.prototype.wasAltered=function(){return this._map.wasAltered()},An.prototype.__iterator=function(t,e){var n=this;return r(this._defaultValues).map((function(t,e){return n.get(e)})).__iterator(t,e)},An.prototype.__iterate=function(t,e){var n=this;return r(this._defaultValues).map((function(t,e){return n.get(e)})).__iterate(t,e)},An.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?In(this,e,t):(this.__ownerID=t,this._map=e,this)};var kn=An.prototype;function In(t,e,n){var r=Object.create(Object.getPrototypeOf(t));return r._map=e,r.__ownerID=n,r}function Sn(t){return t._name||t.constructor.name||"Record"}function xn(t,e){try{e.forEach(On.bind(void 0,t))}catch(t){}}function On(t,e){Object.defineProperty(t,e,{get:function(){return this.get(e)},set:function(t){wt(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}function Mn(t){return null==t?Bn():Nn(t)&&!l(t)?t:Bn().withMutations((function(e){var n=s(t);Yt(n.size),n.forEach((function(t){return e.add(t)}))}))}function Nn(t){return!(!t||!t[Rn])}kn[m]=kn.remove,kn.deleteIn=kn.removeIn=Qt.removeIn,kn.merge=Qt.merge,kn.mergeWith=Qt.mergeWith,kn.mergeIn=Qt.mergeIn,kn.mergeDeep=Qt.mergeDeep,kn.mergeDeepWith=Qt.mergeDeepWith,kn.mergeDeepIn=Qt.mergeDeepIn,kn.setIn=Qt.setIn,kn.update=Qt.update,kn.updateIn=Qt.updateIn,kn.withMutations=Qt.withMutations,kn.asMutable=Qt.asMutable,kn.asImmutable=Qt.asImmutable,e(Mn,It),Mn.of=function(){return this(arguments)},Mn.fromKeys=function(t){return this(r(t).keySeq())},Mn.prototype.toString=function(){return this.__toString("Set {","}")},Mn.prototype.has=function(t){return this._map.has(t)},Mn.prototype.add=function(t){return Pn(this,this._map.set(t,!0))},Mn.prototype.remove=function(t){return Pn(this,this._map.remove(t))},Mn.prototype.clear=function(){return Pn(this,this._map.clear())},Mn.prototype.union=function(){var e=t.call(arguments,0);return 0===(e=e.filter((function(t){return 0!==t.size}))).length?this:0!==this.size||this.__ownerID||1!==e.length?this.withMutations((function(t){for(var n=0;n<e.length;n++)s(e[n]).forEach((function(e){return t.add(e)}))})):this.constructor(e[0])},Mn.prototype.intersect=function(){var e=t.call(arguments,0);if(0===e.length)return this;e=e.map((function(t){return s(t)}));var n=this;return this.withMutations((function(t){n.forEach((function(n){e.every((function(t){return t.includes(n)}))||t.remove(n)}))}))},Mn.prototype.subtract=function(){var e=t.call(arguments,0);if(0===e.length)return this;e=e.map((function(t){return s(t)}));var n=this;return this.withMutations((function(t){n.forEach((function(n){e.some((function(t){return t.includes(n)}))&&t.remove(n)}))}))},Mn.prototype.merge=function(){return this.union.apply(this,arguments)},Mn.prototype.mergeWith=function(e){var n=t.call(arguments,1);return this.union.apply(this,n)},Mn.prototype.sort=function(t){return Un(hn(this,t))},Mn.prototype.sortBy=function(t,e){return Un(hn(this,e,t))},Mn.prototype.wasAltered=function(){return this._map.wasAltered()},Mn.prototype.__iterate=function(t,e){var n=this;return this._map.__iterate((function(e,r){return t(r,r,n)}),e)},Mn.prototype.__iterator=function(t,e){return this._map.map((function(t,e){return e})).__iterator(t,e)},Mn.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t);return t?this.__make(e,t):(this.__ownerID=t,this._map=e,this)},Mn.isSet=Nn;var Cn,Rn="@@__IMMUTABLE_SET__@@",Dn=Mn.prototype;function Pn(t,e){return t.__ownerID?(t.size=e.size,t._map=e,t):e===t._map?t:0===e.size?t.__empty():t.__make(e)}function Ln(t,e){var n=Object.create(Dn);return n.size=t?t.size:0,n._map=t,n.__ownerID=e,n}function Bn(){return Cn||(Cn=Ln(ie()))}function Un(t){return null==t?Gn():jn(t)?t:Gn().withMutations((function(e){var n=s(t);Yt(n.size),n.forEach((function(t){return e.add(t)}))}))}function jn(t){return Nn(t)&&l(t)}Dn[Rn]=!0,Dn[m]=Dn.remove,Dn.mergeDeep=Dn.merge,Dn.mergeDeepWith=Dn.mergeWith,Dn.withMutations=Qt.withMutations,Dn.asMutable=Qt.asMutable,Dn.asImmutable=Qt.asImmutable,Dn.__empty=Bn,Dn.__make=Ln,e(Un,Mn),Un.of=function(){return this(arguments)},Un.fromKeys=function(t){return this(r(t).keySeq())},Un.prototype.toString=function(){return this.__toString("OrderedSet {","}")},Un.isOrderedSet=jn;var Fn,zn=Un.prototype;function Vn(t,e){var n=Object.create(zn);return n.size=t?t.size:0,n._map=t,n.__ownerID=e,n}function Gn(){return Fn||(Fn=Vn(We()))}function Yn(t){return null==t?Xn():Hn(t)?t:Xn().unshiftAll(t)}function Hn(t){return!(!t||!t[Kn])}zn[f]=!0,zn.__empty=Gn,zn.__make=Vn,e(Yn,kt),Yn.of=function(){return this(arguments)},Yn.prototype.toString=function(){return this.__toString("Stack [","]")},Yn.prototype.get=function(t,e){var n=this._head;for(t=x(this,t);n&&t--;)n=n.next;return n?n.value:e},Yn.prototype.peek=function(){return this._head&&this._head.value},Yn.prototype.push=function(){if(0===arguments.length)return this;for(var t=this.size+arguments.length,e=this._head,n=arguments.length-1;n>=0;n--)e={value:arguments[n],next:e};return this.__ownerID?(this.size=t,this._head=e,this.__hash=void 0,this.__altered=!0,this):Qn(t,e)},Yn.prototype.pushAll=function(t){if(0===(t=i(t)).size)return this;Yt(t.size);var e=this.size,n=this._head;return t.reverse().forEach((function(t){e++,n={value:t,next:n}})),this.__ownerID?(this.size=e,this._head=n,this.__hash=void 0,this.__altered=!0,this):Qn(e,n)},Yn.prototype.pop=function(){return this.slice(1)},Yn.prototype.unshift=function(){return this.push.apply(this,arguments)},Yn.prototype.unshiftAll=function(t){return this.pushAll(t)},Yn.prototype.shift=function(){return this.pop.apply(this,arguments)},Yn.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Xn()},Yn.prototype.slice=function(t,e){if(M(t,e,this.size))return this;var n=N(t,this.size);if(C(e,this.size)!==this.size)return kt.prototype.slice.call(this,t,e);for(var r=this.size-n,i=this._head;n--;)i=i.next;return this.__ownerID?(this.size=r,this._head=i,this.__hash=void 0,this.__altered=!0,this):Qn(r,i)},Yn.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?Qn(this.size,this._head,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},Yn.prototype.__iterate=function(t,e){if(e)return this.reverse().__iterate(t);for(var n=0,r=this._head;r&&!1!==t(r.value,n++,this);)r=r.next;return n},Yn.prototype.__iterator=function(t,e){if(e)return this.reverse().__iterator(t);var n=0,r=this._head;return new F((function(){if(r){var e=r.value;return r=r.next,z(t,n++,e)}return V()}))},Yn.isStack=Hn;var Wn,Kn="@@__IMMUTABLE_STACK__@@",qn=Yn.prototype;function Qn(t,e,n,r){var i=Object.create(qn);return i.size=t,i._head=e,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function Xn(){return Wn||(Wn=Qn(0))}function Zn(t,e){var n=function(n){t.prototype[n]=e[n]};return Object.keys(e).forEach(n),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(e).forEach(n),t}qn[Kn]=!0,qn.withMutations=Qt.withMutations,qn.asMutable=Qt.asMutable,qn.asImmutable=Qt.asImmutable,qn.wasAltered=Qt.wasAltered,n.Iterator=F,Zn(n,{toArray:function(){Yt(this.size);var t=new Array(this.size||0);return this.valueSeq().__iterate((function(e,n){t[n]=e})),t},toIndexedSeq:function(){return new Qe(this)},toJS:function(){return this.toSeq().map((function(t){return t&&"function"==typeof t.toJS?t.toJS():t})).__toJS()},toJSON:function(){return this.toSeq().map((function(t){return t&&"function"==typeof t.toJSON?t.toJSON():t})).__toJS()},toKeyedSeq:function(){return new qe(this,!0)},toMap:function(){return Ht(this.toKeyedSeq())},toObject:function(){Yt(this.size);var t={};return this.__iterate((function(e,n){t[n]=e})),t},toOrderedMap:function(){return Ge(this.toKeyedSeq())},toOrderedSet:function(){return Un(a(this)?this.valueSeq():this)},toSet:function(){return Mn(a(this)?this.valueSeq():this)},toSetSeq:function(){return new Xe(this)},toSeq:function(){return c(this)?this.toIndexedSeq():a(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Yn(a(this)?this.valueSeq():this)},toList:function(){return ke(a(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(t,e){return 0===this.size?t+e:t+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+e},concat:function(){return mn(this,an(this,t.call(arguments,0)))},includes:function(t){return this.some((function(e){return bt(e,t)}))},entries:function(){return this.__iterator(L)},every:function(t,e){Yt(this.size);var n=!0;return this.__iterate((function(r,i,s){if(!t.call(e,r,i,s))return n=!1,!1})),n},filter:function(t,e){return mn(this,tn(this,t,e,!0))},find:function(t,e,n){var r=this.findEntry(t,e);return r?r[1]:n},forEach:function(t,e){return Yt(this.size),this.__iterate(e?t.bind(e):t)},join:function(t){Yt(this.size),t=void 0!==t?""+t:",";var e="",n=!0;return this.__iterate((function(r){n?n=!1:e+=t,e+=null!=r?r.toString():""})),e},keys:function(){return this.__iterator(D)},map:function(t,e){return mn(this,_e(this,t,e))},reduce:function(t,e,n){var r,i;return Yt(this.size),arguments.length<2?i=!0:r=e,this.__iterate((function(e,s,o){i?(i=!1,r=e):r=t.call(n,r,e,s,o)})),r},reduceRight:function(t,e,n){var r=this.toKeyedSeq().reverse();return r.reduce.apply(r,arguments)},reverse:function(){return mn(this,$e(this,!0))},slice:function(t,e){return mn(this,rn(this,t,e,!0))},some:function(t,e){return!this.every(er(t),e)},sort:function(t){return mn(this,hn(this,t))},values:function(){return this.__iterator(P)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some((function(){return!0}))},count:function(t,e){return S(t?this.toSeq().filter(t,e):this)},countBy:function(t,e){return en(this,t,e)},equals:function(t){return yt(this,t)},entrySeq:function(){var t=this;if(t._cache)return new et(t._cache);var e=t.toSeq().map(tr).toIndexedSeq();return e.fromEntrySeq=function(){return t.toSeq()},e},filterNot:function(t,e){return this.filter(er(t),e)},findEntry:function(t,e,n){var r=n;return this.__iterate((function(n,i,s){if(t.call(e,n,i,s))return r=[i,n],!1})),r},findKey:function(t,e){var n=this.findEntry(t,e);return n&&n[0]},findLast:function(t,e,n){return this.toKeyedSeq().reverse().find(t,e,n)},findLastEntry:function(t,e,n){return this.toKeyedSeq().reverse().findEntry(t,e,n)},findLastKey:function(t,e){return this.toKeyedSeq().reverse().findKey(t,e)},first:function(){return this.find(O)},flatMap:function(t,e){return mn(this,un(this,t,e))},flatten:function(t){return mn(this,cn(this,t,!0))},fromEntrySeq:function(){return new Ze(this)},get:function(t,e){return this.find((function(e,n){return bt(n,t)}),void 0,e)},getIn:function(t,e){for(var n,r=this,i=En(t);!(n=i.next()).done;){var s=n.value;if((r=r&&r.get?r.get(s,v):v)===v)return e}return r},groupBy:function(t,e){return nn(this,t,e)},has:function(t){return this.get(t,v)!==v},hasIn:function(t){return this.getIn(t,v)!==v},isSubset:function(t){return t="function"==typeof t.includes?t:n(t),this.every((function(e){return t.includes(e)}))},isSuperset:function(t){return(t="function"==typeof t.isSubset?t:n(t)).isSubset(this)},keyOf:function(t){return this.findKey((function(e){return bt(e,t)}))},keySeq:function(){return this.toSeq().map($n).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(t){return this.toKeyedSeq().reverse().keyOf(t)},max:function(t){return dn(this,t)},maxBy:function(t,e){return dn(this,e,t)},min:function(t){return dn(this,t?nr(t):sr)},minBy:function(t,e){return dn(this,e?nr(e):sr,t)},rest:function(){return this.slice(1)},skip:function(t){return this.slice(Math.max(0,t))},skipLast:function(t){return mn(this,this.toSeq().reverse().skip(t).reverse())},skipWhile:function(t,e){return mn(this,on(this,t,e,!0))},skipUntil:function(t,e){return this.skipWhile(er(t),e)},sortBy:function(t,e){return mn(this,hn(this,e,t))},take:function(t){return this.slice(0,Math.max(0,t))},takeLast:function(t){return mn(this,this.toSeq().reverse().take(t).reverse())},takeWhile:function(t,e){return mn(this,sn(this,t,e))},takeUntil:function(t,e){return this.takeWhile(er(t),e)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=or(this))}});var Jn=n.prototype;Jn[h]=!0,Jn[j]=Jn.values,Jn.__toJS=Jn.toArray,Jn.__toStringMapper=rr,Jn.inspect=Jn.toSource=function(){return this.toString()},Jn.chain=Jn.flatMap,Jn.contains=Jn.includes,Zn(r,{flip:function(){return mn(this,Je(this))},mapEntries:function(t,e){var n=this,r=0;return mn(this,this.toSeq().map((function(i,s){return t.call(e,[s,i],r++,n)})).fromEntrySeq())},mapKeys:function(t,e){var n=this;return mn(this,this.toSeq().flip().map((function(r,i){return t.call(e,r,i,n)})).flip())}});var _n=r.prototype;function $n(t,e){return e}function tr(t,e){return[e,t]}function er(t){return function(){return!t.apply(this,arguments)}}function nr(t){return function(){return-t.apply(this,arguments)}}function rr(t){return"string"==typeof t?JSON.stringify(t):String(t)}function ir(){return I(arguments)}function sr(t,e){return t<e?1:t>e?-1:0}function or(t){if(t.size===1/0)return 0;var e=l(t),n=a(t),r=e?1:0;return ar(t.__iterate(n?e?function(t,e){r=31*r+cr(Ot(t),Ot(e))|0}:function(t,e){r=r+cr(Ot(t),Ot(e))|0}:e?function(t){r=31*r+Ot(t)|0}:function(t){r=r+Ot(t)|0}),r)}function ar(t,e){return e=St(e,3432918353),e=St(e<<15|e>>>-15,461845907),e=St(e<<13|e>>>-13,5),e=St((e=e+3864292196^t)^e>>>16,2246822507),e=xt((e=St(e^e>>>13,3266489909))^e>>>16)}function cr(t,e){return t^e+2654435769+(t<<6)+(t>>2)}return _n[d]=!0,_n[j]=Jn.entries,_n.__toJS=Jn.toObject,_n.__toStringMapper=function(t,e){return JSON.stringify(e)+": "+rr(t)},Zn(i,{toKeyedSeq:function(){return new qe(this,!1)},filter:function(t,e){return mn(this,tn(this,t,e,!1))},findIndex:function(t,e){var n=this.findEntry(t,e);return n?n[0]:-1},indexOf:function(t){var e=this.keyOf(t);return void 0===e?-1:e},lastIndexOf:function(t){var e=this.lastKeyOf(t);return void 0===e?-1:e},reverse:function(){return mn(this,$e(this,!1))},slice:function(t,e){return mn(this,rn(this,t,e,!1))},splice:function(t,e){var n=arguments.length;if(e=Math.max(0|e,0),0===n||2===n&&!e)return this;t=N(t,t<0?this.count():this.size);var r=this.slice(0,t);return mn(this,1===n?r:r.concat(I(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var n=this.findLastEntry(t,e);return n?n[0]:-1},first:function(){return this.get(0)},flatten:function(t){return mn(this,cn(this,t,!1))},get:function(t,e){return(t=x(this,t))<0||this.size===1/0||void 0!==this.size&&t>this.size?e:this.find((function(e,n){return n===t}),void 0,e)},has:function(t){return(t=x(this,t))>=0&&(void 0!==this.size?this.size===1/0||t<this.size:-1!==this.indexOf(t))},interpose:function(t){return mn(this,ln(this,t))},interleave:function(){var t=[this].concat(I(arguments)),e=fn(this.toSeq(),X.of,t),n=e.flatten(!0);return e.size&&(n.size=e.size*t.length),mn(this,n)},keySeq:function(){return Tt(0,this.size)},last:function(){return this.get(-1)},skipWhile:function(t,e){return mn(this,on(this,t,e,!1))},zip:function(){return mn(this,fn(this,ir,[this].concat(I(arguments))))},zipWith:function(t){var e=I(arguments);return e[0]=this,mn(this,fn(this,t,e))}}),i.prototype[p]=!0,i.prototype[f]=!0,Zn(s,{get:function(t,e){return this.has(t)?t:e},includes:function(t){return this.has(t)},keySeq:function(){return this.valueSeq()}}),s.prototype.has=Jn.includes,s.prototype.contains=s.prototype.includes,Zn(Q,r.prototype),Zn(X,i.prototype),Zn(Z,s.prototype),Zn(At,r.prototype),Zn(kt,i.prototype),Zn(It,s.prototype),{Iterable:n,Seq:q,Collection:Et,Map:Ht,OrderedMap:Ge,List:ke,Stack:Yn,Set:Mn,OrderedSet:Un,Record:An,Range:Tt,Repeat:vt,is:bt,fromJS:pt}}()},function(t,e,n){const r=n(0),i=[];class s{constructor(t){this.isLoop=!1,this.warpMode=t,this.justReported=null,this.reporting="",this.reported=null,this.waitingReporter=null,this.params=null,this.executionContext=null,this.op=null}reset(){return this.isLoop=!1,this.warpMode=!1,this.justReported=null,this.reported=null,this.waitingReporter=null,this.params=null,this.executionContext=null,this.op=null,this}reuse(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.warpMode;return this.reset(),this.warpMode=Boolean(t),this}static create(t){const e=i.pop();return void 0!==e?(e.warpMode=Boolean(t),e):new s(t)}static release(t){void 0!==t&&i.push(t.reset())}}class o{constructor(t){this.topBlock=t,this.stack=[],this.stackFrames=[],this.status=0,this.isKilled=!1,this.target=null,this.blockContainer=null,this.requestScriptGlowInFrame=!1,this.blockGlowInFrame=null,this.warpTimer=null,this.justReported=null,this.triedToCompile=!1,this.isCompiled=!1,this.timer=null,this.generator=null,this.procedures=null,this.executableHat=!1,this.compatibilityStackFrame=null}static get STATUS_RUNNING(){return 0}static get STATUS_PROMISE_WAIT(){return 1}static get STATUS_YIELD(){return 2}static get STATUS_YIELD_TICK(){return 3}static get STATUS_DONE(){return 4}static getIdFromTargetAndBlock(t,e){return"".concat(t.id,"&").concat(e)}getId(){return o.getIdFromTargetAndBlock(this.target,this.topBlock)}pushStack(t){if(this.stack.push(t),this.stack.length>this.stackFrames.length){const t=this.stackFrames[this.stackFrames.length-1];this.stackFrames.push(s.create(void 0!==t&&t.warpMode))}}reuseStackForNextBlock(t){this.stack[this.stack.length-1]=t,this.stackFrames[this.stackFrames.length-1].reuse()}popStack(){return s.release(this.stackFrames.pop()),this.stack.pop()}stopThisScript(){let t=this.peekStack();for(;null!==t;){const e=this.target.blocks.getBlock(t);if(this.peekStackFrame().waitingReporter)break;if(void 0!==e&&"procedures_call"===e.opcode){this.goToNextBlock();break}this.popStack(),t=this.peekStack()}0===this.stack.length&&(this.requestScriptGlowInFrame=!1,this.status=o.STATUS_DONE)}peekStack(){return this.stack.length>0?this.stack[this.stack.length-1]:null}peekStackFrame(){return this.stackFrames.length>0?this.stackFrames[this.stackFrames.length-1]:null}peekParentStackFrame(){return this.stackFrames.length>1?this.stackFrames[this.stackFrames.length-2]:null}pushReportedValue(t){this.justReported=void 0===t?null:t}initParams(){const t=this.peekStackFrame();null===t.params&&(t.params={})}pushParam(t,e){this.peekStackFrame().params[t]=e}getParam(t){for(let e=this.stackFrames.length-1;e>=0;e--){const n=this.stackFrames[e];if(null!==n.params)return Object.prototype.hasOwnProperty.call(n.params,t)?n.params[t]:null}return null}getAllparams(){return this.peekStackFrame().params}atStackTop(){return this.peekStack()===this.topBlock}goToNextBlock(){const t=this.target.blocks.getNextBlock(this.peekStack());this.reuseStackForNextBlock(t)}isRecursiveCall(t){let e=5;for(let n=this.stackFrames.length-1-1;n>=0;n--){const r=this.target.blocks.getBlock(this.stackFrames[n].op.id)||this.target.runtime.flyoutBlocks.getBlock(this.stackFrames[n].op.id);if("procedures_call"===r.opcode&&r.mutation.proccode===t)return!0;if(--e<0)return!1}return!1}tryCompile(){if(!this.blockContainer)return;const t=n(186);this.triedToCompile=!0;const e=!this.stackClick,i=this.topBlock,s=this.blockContainer.getBlock(i)?this.blockContainer:this.target.runtime.flyoutBlocks,o=e&&s.getCachedCompileResult(i);if(o&&!o.success)return;let a;if(o)a=o.value;else try{a=t(this),e&&s.cacheCompileResult(i,a)}catch(t){return r.error("cannot compile script",this.target.getName(),t),e&&s.cacheCompileError(i,t),void this.target.runtime.emitCompileError(this.target,t)}this.procedures={};for(const t of Object.keys(a.procedures))this.procedures[t]=a.procedures[t](this);this.generator=a.startingFunction(this)(),this.executableHat=a.executableHat,this.blockContainer.forceNoGlow||(this.blockGlowInFrame=this.topBlock,this.requestScriptGlowInFrame=!0),this.isCompiled=!0}}o._StackFrame=s,t.exports=o},function(t,e,n){const r=n(231),i=n(244),s=n(77),o=n(73),a=n(246),c=n(76),u=n(49),l=n(74),h=n(247),d=n(48);t.exports={BitmapAdapter:i,convertFonts:l,inlineSvgFonts:s,loadSvgString:o,sanitizeSvg:a,serializeSvgToString:c,SvgElement:u,SVGRenderer:r,fixForVanilla:h,DOMPurify:d}},function(t,e,n){const r=n(39),i=n(15),s=n(47),o=n(9),a=n(46),c=n(40),u=n(12),l=n(0),h=n(7),d=n(4),p=n(6),f=n(72),m=n(255),{loadCostume:g}=n(31),{loadSound:b}=n(30),{deserializeCostume:y,deserializeSound:v}=n(81),w=Object.prototype.hasOwnProperty,T=["argument","colour","control","data","event","looks","math","motion","operator","procedures","sensing","sound"],E=12,A=13,k={math_number:[4,"NUM"],math_positive_number:[5,"NUM"],math_whole_number:[6,"NUM"],math_integer:[7,"NUM"],math_angle:[8,"NUM"],colour_picker:[9,"COLOUR"],text:[10,"TEXT"],event_broadcast_menu:[11,"BROADCAST_OPTION"],data_variable:[E,"VARIABLE"],data_listcontents:[A,"LIST"]},I=8e3,S=function(t){const e=function(t){if(w.call(k,t.opcode)){const e=k[t.opcode],n=e[0],r=e[1],i=t.fields[r],s=[n,i.value];return"event_broadcast_menu"===t.opcode?s.push(i.id):"data_variable"!==t.opcode&&"data_listcontents"!==t.opcode||(s.push(i.id),t.topLevel&&(s.push(t.x?Math.round(t.x):0),s.push(t.y?Math.round(t.y):0))),s}return null}(t);if(e)return e;const n=Object.create(null);return n.opcode=t.opcode,n.next=t.next,n.parent=t.parent,n.inputs=function(t){const e=Object.create(null);for(const n in t)w.call(t,n)&&(t[n].block===t[n].shadow?e[n]=[1,t[n].block]:null===t[n].shadow?e[n]=[2,t[n].block]:e[n]=[3,t[n].block,t[n].shadow]);return e}(t.inputs),n.fields=function(t){const e=Object.create(null);for(const n in t)w.call(t,n)&&(e[n]=[t[n].value],Object.prototype.hasOwnProperty.call(t[n],"id")&&e[n].push(t[n].id));return e}(t.fields),n.shadow=t.shadow,t.topLevel?(n.topLevel=!0,n.x=t.x?Math.round(t.x):0,n.y=t.y?Math.round(t.y):0):n.topLevel=!1,t.mutation&&(n.mutation=t.mutation),t.comment&&(n.comment=t.comment),n},x=function(t,e){const n=t.inputs;for(const t in n){const r=n[t];for(let t=1;t<r.length;t++){if(!r[t])continue;const n=r[t],i=e[n];Array.isArray(i)&&(r[t]=i,delete e[n])}}return t},O=function(t){const e=t.indexOf("_"),n=t.substring(0,e).replace(/[^\w-]/g,"-");if(-1===T.indexOf(n)&&""!==n)return n},M=(t,e)=>{if(!e.extensionManager)return null;const n=e.extensionManager.getExtensionURLs(),r={};for(const e of t){const t=n[e];"string"==typeof t&&(r[e]=t)}return 0===Object.keys(r).length?null:r},N=function(t){const e=Object.create(null),n=new Set;for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;e[r]=S(t[r]);const i=O(t[r].opcode);i&&n.add(i)}for(const t in e){const n=e[t];e[t]=x(n,e)}for(const t in e){const n=e[t];Array.isArray(n)&&[E,A].indexOf(n[0])<0&&(l.warn("Found an unexpected top level primitive with block ID: ".concat(t,"; deleting it from serialized blocks.")),delete e[t])}return[e,Array.from(n)]},C=function(t){const e=Object.create(null);e.name=t.name;const n=t.broken||t;return e.bitmapResolution=n.bitmapResolution,e.dataFormat=n.dataFormat.toLowerCase(),e.assetId=n.assetId,e.md5ext=n.md5,e.rotationCenterX=n.rotationCenterX,e.rotationCenterY=n.rotationCenterY,e},R=function(t){const e=Object.create(null);e.name=t.name;const n=t.broken||t;return e.assetId=n.assetId,e.dataFormat=n.dataFormat.toLowerCase(),e.format=n.format,e.rate=n.rate,e.sampleCount=n.sampleCount,e.md5ext=n.md5,e},D=t=>"number"==typeof t||"string"==typeof t||"boolean"==typeof t,P=t=>{if(Array.isArray(t)){let e=null;for(let n=0;n<t.length;n++)D(t[n])||(e||(e=t.slice()),e[n]="".concat(e[n]));return e||t}return D(t)?t:"".concat(t)},L=function(t,e){const n=Object.create(null);let r=[];n.isStage=t.isStage,n.name=n.isStage?"Stage":t.name;const i=function(t){const e=Object.create(null);e.variables=Object.create(null),e.lists=Object.create(null),e.broadcasts=Object.create(null);for(const n in t){const r=t[n];r.type!==o.BROADCAST_MESSAGE_TYPE?r.type!==o.LIST_TYPE?(e.variables[n]=[r.name,P(r.value)],r.isCloud&&e.variables[n].push(!0)):e.lists[n]=[r.name,P(r.value)]:e.broadcasts[n]=r.value}return e}(t.variables);return n.variables=i.variables,n.lists=i.lists,n.broadcasts=i.broadcasts,[n.blocks,r]=N(t.blocks),n.comments=function(t){const e=Object.create(null);for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const r=t[n],i=Object.create(null);i.blockId=r.blockId,i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height,i.minimized=r.minimized,r.text.length>I?(i.text=r.text.substring(0,I),i.extraText=r.text.substring(I)):i.text=r.text,e[n]=i}return e}(t.comments),(t.currentCostume<0||t.currentCostume>=t.costumes.length)&&(l.warn("currentCostume property for target ".concat(t.name," is out of range")),t.currentCostume=d.clamp(t.currentCostume,0,t.costumes.length-1)),n.currentCostume=t.currentCostume,n.costumes=t.costumes.map(C),n.sounds=t.sounds.map(R),Object.prototype.hasOwnProperty.call(t,"volume")&&(n.volume=t.volume),Object.prototype.hasOwnProperty.call(t,"layerOrder")&&(n.layerOrder=t.layerOrder),n.isStage?(Object.prototype.hasOwnProperty.call(t,"tempo")&&(n.tempo=t.tempo),Object.prototype.hasOwnProperty.call(t,"videoTransparency")&&(n.videoTransparency=t.videoTransparency),Object.prototype.hasOwnProperty.call(t,"videoState")&&(n.videoState=t.videoState),Object.prototype.hasOwnProperty.call(t,"textToSpeechLanguage")&&(n.textToSpeechLanguage=t.textToSpeechLanguage)):(n.visible=t.visible,n.x=t.x,n.y=t.y,n.size=t.size,n.direction=t.direction,n.draggable=t.draggable,n.rotationStyle=t.rotationStyle),r.forEach((t=>{e.add(t)})),n},B=(t,e)=>{const n={};let r=!0;for(const[i,s]of Object.entries(t))e.has(i)&&null!=s&&(r=!1,n[i]=t[i]);return r?null:n},U=function(t,e,n,r){if(!Array.isArray(t))return t;const i=Object.create(null),s=h();switch(i.id=s,i.next=null,i.parent=e,i.shadow=n,i.inputs=Object.create(null),t[0]){case 4:i.opcode="math_number",i.fields={NUM:{name:"NUM",value:t[1]}},i.topLevel=!1;break;case 5:i.opcode="math_positive_number",i.fields={NUM:{name:"NUM",value:t[1]}},i.topLevel=!1;break;case 6:i.opcode="math_whole_number",i.fields={NUM:{name:"NUM",value:t[1]}},i.topLevel=!1;break;case 7:i.opcode="math_integer",i.fields={NUM:{name:"NUM",value:t[1]}},i.topLevel=!1;break;case 8:i.opcode="math_angle",i.fields={NUM:{name:"NUM",value:t[1]}},i.topLevel=!1;break;case 9:i.opcode="colour_picker",i.fields={COLOUR:{name:"COLOUR",value:t[1]}},i.topLevel=!1;break;case 10:i.opcode="text",i.fields={TEXT:{name:"TEXT",value:t[1]}},i.topLevel=!1;break;case 11:i.opcode="event_broadcast_menu",i.fields={BROADCAST_OPTION:{name:"BROADCAST_OPTION",value:t[1],id:t[2],variableType:o.BROADCAST_MESSAGE_TYPE}},i.topLevel=!1;break;case E:i.opcode="data_variable",i.fields={VARIABLE:{name:"VARIABLE",value:t[1],id:t[2],variableType:o.SCALAR_TYPE}},t.length>3&&(i.topLevel=!0,i.x=t[3],i.y=t[4]);break;case A:i.opcode="data_listcontents",i.fields={LIST:{name:"LIST",value:t[1],id:t[2],variableType:o.LIST_TYPE}},t.length>3&&(i.topLevel=!0,i.x=t[3],i.y=t[4]);break;default:return l.error("Found unknown primitive type during deserialization: ".concat(JSON.stringify(t))),null}return r[s]=i,s},j=function(t,e,n){const r={};for(const i in t){if(!w.call(t,i))continue;const s=t[i];if(!Array.isArray(s))continue;let o=null,a=null;const c=s[0];1===c?o=a=U(s[1],e,!0,n):2===c?o=U(s[1],e,!1,n):(o=U(s[1],e,!1,n),a=U(s[2],e,!0,n)),r[i]={name:i,block:o,shadow:a}}return r},F=function(t){const e={};for(const n in t){if(!w.call(t,n))continue;const r=t[n];Array.isArray(r)&&(e[n]={name:n,value:r[0]},r.length>1&&(e[n].id=r[1]),"BROADCAST_OPTION"===n?e[n].variableType=o.BROADCAST_MESSAGE_TYPE:"VARIABLE"===n?e[n].variableType=o.SCALAR_TYPE:"LIST"===n&&(e[n].variableType=o.LIST_TYPE))}return e},z=function(t){for(const e in t){if(!Object.prototype.hasOwnProperty.call(t,e))continue;const n=t[e];Array.isArray(n)?(delete t[e],U(n,null,!1,t)):(n.id=e,n.inputs=j(n.inputs,e,t),n.fields=F(n.fields))}return t};t.exports={serialize:function(t,e){let{allowOptimization:n=!0}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=Object.create(null),i=new Set,s=e?[t.getTargetById(e)]:t.targets.filter((t=>t.isOriginal)),o=function(t){const e=t.map((t=>t.getLayerOrder()));return d.reducedSortOrdering(e)}(s),a=s.map((t=>t.toJSON()));t.renderer&&!e&&a.forEach(((t,e)=>{t.layerOrder=o[e]}));const c=a.map((t=>L(t,i))).map(((t,e)=>{const n=s[e],r=B(n.extensionStorage,i);return r&&(t.extensionStorage=r),t})),u=t.fontManager.serializeJSON();if(e){const e=c[0];i.size&&(e.extensions=Array.from(i));const n=M(i,t);return n&&(e.extensionURLs=n),u&&(e.customFonts=u),c[0]}const l=B(t.extensionStorage,i);l&&(r.extensionStorage=l),r.targets=c,r.monitors=function(t,e,n){const r=(e.stageWidth-480)/2,i=(e.stageHeight-360)/2;return t.valueSeq().filter((t=>{const e=O(t.opcode);return!e||!!t.visible&&(n.add(e),!0)})).map((t=>{const e={id:t.id,mode:t.mode,opcode:t.opcode,params:t.params,spriteName:t.spriteName,value:Array.isArray(t.value)?[]:0,width:t.width,height:t.height,x:t.x-r,y:t.y-i,visible:t.visible};return"list"!==t.mode&&(e.sliderMin=t.sliderMin,e.sliderMax=t.sliderMax,e.isDiscrete=t.isDiscrete),e})).toArray()}(t.getMonitorState(),t,i),r.extensions=Array.from(i);const h=M(i,t);h&&(r.extensionURLs=h),u&&(r.customFonts=u);const p=Object.create(null);return p.semver="3.0.0",p.vm="0.2.0",t.origin&&(p.origin=t.origin),p.agent="",p.platform=Object.assign({},t.platform),r.meta=p,n&&m(r),r},deserialize:async function(t,e,n,h){await((t,e)=>{if(!t.meta||!t.meta.platform)return;if(t.meta.platform.name===e.platform.name)return;let n=e.listenerCount(r.PLATFORM_MISMATCH);return 0!==n?new Promise((i=>{e.emit(r.PLATFORM_MISMATCH,t.meta.platform,(()=>{n--,0===n&&i()}))})):void 0})(t,e);const m={extensionIDs:new Set,extensionURLs:new Map};if(t.meta&&t.meta.origin?e.origin=t.meta.origin:e.origin=null,t.extensionURLs)for(const[e,n]of Object.entries(t.extensionURLs))m.extensionURLs.set(e,n);let w;w=t.customFonts?e.fontManager.deserialize(t.customFonts,n,h):Promise.resolve();const T=((h?[t]:t.targets)||[]).map(((t,e)=>Object.assign(t,{targetPaneOrder:e}))).sort(((t,e)=>t.layerOrder-e.layerOrder)),E=t.monitors||[];return w.then((()=>T.map((t=>function(t,e,n){if(!Object.prototype.hasOwnProperty.call(t,"name"))return Promise.resolve(null);const r={costumePromises:null,soundPromises:null,soundBank:e.audioEngine&&e.audioEngine.createBank()};return r.costumePromises=(t.costumes||[]).map((t=>{const r={asset:t.asset,assetId:t.assetId,skinId:null,name:t.name,bitmapResolution:t.bitmapResolution,rotationCenterX:t.rotationCenterX,rotationCenterY:t.rotationCenterY},i=t.dataFormat||t.assetType&&t.assetType.runtimeFormat||"png",s=Object.prototype.hasOwnProperty.call(t,"md5ext")?t.md5ext:"".concat(t.assetId,".").concat(i);return r.md5=s,r.dataFormat=i,e.wrapAssetRequest((()=>y(r,e,n).then((()=>g(s,r,e)))))})),r.soundPromises=(t.sounds||[]).map((t=>{const i={assetId:t.assetId,format:t.format,rate:t.rate,sampleCount:t.sampleCount,name:t.name,md5:t.md5ext,dataFormat:t.dataFormat,data:null};return e.wrapAssetRequest((()=>v(i,e,n).then((()=>b(i,e,r.soundBank)))))})),r}(t,e,n))))).then((t=>Promise.resolve(t))).then((t=>Promise.all(T.map(((n,r)=>function(t,e,n,r,c){if(!Object.prototype.hasOwnProperty.call(t,"name"))return Promise.resolve(null);const l=new i(e),h=new s(l,e);if(Object.prototype.hasOwnProperty.call(t,"name")&&(h.name=t.name),Object.prototype.hasOwnProperty.call(t,"blocks")){z(t.blocks);for(const e in t.blocks){if(!Object.prototype.hasOwnProperty.call(t.blocks,e))continue;const r=t.blocks[e];l.createBlock(r);const i=O(r.opcode);i&&n.extensionIDs.add(i)}}const{costumePromises:p}=c,{soundBank:f,soundPromises:m}=c,g=h.createClone(t.isStage?u.BACKGROUND_LAYER:u.SPRITE_LAYER);if(Object.prototype.hasOwnProperty.call(t,"tempo")&&(g.tempo=t.tempo),Object.prototype.hasOwnProperty.call(t,"volume")&&(g.volume=t.volume),Object.prototype.hasOwnProperty.call(t,"videoTransparency")&&(g.videoTransparency=t.videoTransparency),Object.prototype.hasOwnProperty.call(t,"videoState")&&(g.videoState=t.videoState),Object.prototype.hasOwnProperty.call(t,"textToSpeechLanguage")&&(g.textToSpeechLanguage=t.textToSpeechLanguage),Object.prototype.hasOwnProperty.call(t,"variables"))for(const n in t.variables){const r=t.variables[n],i=3===r.length&&r[2]&&t.isStage&&e.canAddCloudVariable(),s=new o(n,r[0],o.SCALAR_TYPE,i);i&&e.addCloudVariable(),s.value=r[1],g.variables[s.id]=s}if(Object.prototype.hasOwnProperty.call(t,"lists"))for(const e in t.lists){const n=t.lists[e],r=new o(e,n[0],o.LIST_TYPE,!1);r.value=n[1],g.variables[r.id]=r}if(Object.prototype.hasOwnProperty.call(t,"broadcasts"))for(const e in t.broadcasts){const n=t.broadcasts[e],r=new o(e,n,o.BROADCAST_MESSAGE_TYPE,!1);g.variables[r.id]=r}if(Object.prototype.hasOwnProperty.call(t,"comments"))for(const e in t.comments){const n=t.comments[e],r=new a(e,n.text+("string"==typeof n.extraText?n.extraText:""),n.x,n.y,n.width,n.height,n.minimized);n.blockId&&(r.blockId=n.blockId),g.comments[r.id]=r}return Object.prototype.hasOwnProperty.call(t,"x")&&(g.x=t.x),Object.prototype.hasOwnProperty.call(t,"y")&&(g.y=t.y),Object.prototype.hasOwnProperty.call(t,"direction")&&(g.direction=d.wrapClamp(t.direction,-179,180)),Object.prototype.hasOwnProperty.call(t,"size")&&(g.size=t.size),Object.prototype.hasOwnProperty.call(t,"visible")&&(g.visible=t.visible),Object.prototype.hasOwnProperty.call(t,"currentCostume")&&(g.currentCostume=d.clamp(t.currentCostume,0,t.costumes.length-1)),Object.prototype.hasOwnProperty.call(t,"rotationStyle")&&(g.rotationStyle=t.rotationStyle),Object.prototype.hasOwnProperty.call(t,"isStage")&&(g.isStage=t.isStage),Object.prototype.hasOwnProperty.call(t,"targetPaneOrder")&&(g.targetPaneOrder=t.targetPaneOrder),Object.prototype.hasOwnProperty.call(t,"draggable")&&(g.draggable=t.draggable),Object.prototype.hasOwnProperty.call(t,"extensionStorage")&&(g.extensionStorage=t.extensionStorage),Promise.all(p).then((t=>{h.costumes=t})),Promise.all(m).then((t=>{h.sounds=t,h.soundBank=f||null})),Promise.all(p.concat(m)).then((()=>g))}(n,e,m,0,t[r])))))).then((t=>t.map(((t,e)=>(t.layerOrder=e,t))).sort(((t,e)=>t.targetPaneOrder-e.targetPaneOrder)).map((t=>(delete t.targetPaneOrder,t))))).then((t=>function(t){const e=f.getAllVarRefsForTargets(t,!0);t.forEach((t=>{Object.keys(t.variables).forEach((e=>{const n=p.replaceUnsafeChars(e);n!==e&&(t.variables[e].id=n,t.variables[n]=t.variables[e],delete t.variables[e])}))}));for(const t in e){const n=p.replaceUnsafeChars(t);t!==n&&f.updateVariableIdentifiers(e[t],n)}return t}(t))).then((n=>(E.map((t=>function(t,e,n,r){const i=(e.stageWidth-480)/2,s=(e.stageHeight-360)/2;if(t.x+=i,t.y+=s,t.x=d.clamp(t.x,0,e.stageWidth),t.y=d.clamp(t.y,0,e.stageHeight),t.spriteName){const e=n.filter((e=>e.sprite.name===t.spriteName));e&&e.length>0?t.targetId=e[0].id:l.warn("Tried to deserialize sprite specific monitor ".concat(t.opcode," but could not find sprite ").concat(t.spriteName,"."))}const a=e.monitorBlockInfo[t.opcode];if("data_listcontents"===t.opcode){const e=t.targetId?n.find((e=>e.id===t.targetId)):n.find((t=>t.isStage));e&&Object.prototype.hasOwnProperty.call(e.variables,t.id)&&(t.params.LIST=e.variables[t.id].name)}const u={};for(const e in t.params){const n={name:e,value:t.params[e]};u[e]=n}"data_variable"!==t.opcode&&"data_listcontents"!==t.opcode&&a&&a.isSpriteSpecific?t.id=a.getId(t.targetId,u):t.id=p.replaceUnsafeChars(t.id);const h=e.monitorBlocks._blocks[t.id];if(h)h.isMonitored=t.visible,h.targetId=t.targetId;else{const n={id:t.id,opcode:t.opcode,inputs:{},fields:u,topLevel:!0,next:null,parent:null,shadow:!1,x:0,y:0,isMonitored:t.visible,targetId:t.targetId};if("data_variable"===t.opcode){const e=n.fields.VARIABLE;e.id=t.id,e.variableType=o.SCALAR_TYPE}else if("data_listcontents"===t.opcode){const e=n.fields.LIST;e.id=t.id,e.variableType=o.LIST_TYPE}e.monitorBlocks.createBlock(n);const i=O(n.opcode);i&&r.extensionIDs.add(i)}e.requestAddMonitor(c(t))}(t,e,n,m))),Object.prototype.hasOwnProperty.call(t,"extensionStorage")&&(e.extensionStorage=t.extensionStorage),n))).then((t=>({targets:t,extensions:m})))},deserializeBlocks:z,serializeBlocks:N,deserializeStandaloneBlocks:t=>{if((t=JSON.parse(JSON.stringify(t))).extensionURLs){const e=new Map;for(const[n,r]of Object.entries(t.extensionURLs))e.set(n,r);return{blocks:t.blocks,extensionURLs:e}}return{blocks:t,extensionURLs:new Map}},serializeStandaloneBlocks:(t,e)=>{const n=new Set;for(const e of t){const t=O(e.opcode);t&&n.add(t)}const r=M(n,e);return r?{blocks:t,extensionURLs:r}:t},getExtensionIdForOpcode:O}},function(t,e,n){const r=n(10),i=n(32),s=n(264);t.exports=class{constructor(t,e){this._renderer=e,this._id=t,this._rotationCenter=r.v3.create(0,0),this._texture=null,this._uniforms={u_skinSize:[0,0],u_skin:null},this._silhouette=new s,this.private=!1}dispose(){this._id=i.ID_NONE}get id(){return this._id}get rotationCenter(){return this._rotationCenter}get size(){return[0,0]}useNearest(t,e){return!0}calculateRotationCenter(){return[this.size[0]/2,this.size[1]/2]}getTexture(t){return this._emptyImageTexture}getFenceBounds(t,e){return t.getAABB(e)}getUniforms(t){return this._uniforms.u_skin=this.getTexture(t),this._uniforms.u_skinSize=this.size,this._uniforms}emitWasAltered(){this._renderer.skinWasAltered(this)}updateSilhouette(){this._silhouette.unlazy()}_setTexture(t){const e=this._renderer.gl;e.bindTexture(e.TEXTURE_2D,this._texture),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),this._silhouette.update(t)}setEmptyImageData(){if(this._texture=null,!this._emptyImageData){this._emptyImageData=new ImageData(1,1);const t=this._renderer.gl,e={auto:!0,wrap:t.CLAMP_TO_EDGE,src:this._emptyImageData};this._emptyImageTexture=r.createTexture(t,e)}this._rotationCenter[0]=0,this._rotationCenter[1]=0,this._silhouette.update(this._emptyImageData),this.emitWasAltered()}isTouchingNearest(t){return this._silhouette.isTouchingNearest(t)}isTouchingLinear(t){return this._silhouette.isTouchingLinear(t)}}},function(t,e,n){const r=n(10);class i{constructor(t){this._gl=t,this._shaderCache={};for(const t in i.DRAW_MODE)Object.prototype.hasOwnProperty.call(i.DRAW_MODE,t)&&(this._shaderCache[t]=[])}getShader(t,e){const n=this._shaderCache[t];t===i.DRAW_MODE.silhouette&&(e&=~(i.EFFECT_INFO.color.mask|i.EFFECT_INFO.brightness.mask));let r=n[e];return r||(r=n[e]=this._buildShader(t,e)),r}_buildShader(t,e){const s=i.EFFECTS.length,o=["#define DRAW_MODE_".concat(t)];for(let t=0;t<s;++t)e&1<<t&&o.push("#define ENABLE_".concat(i.EFFECTS[t]));const a="".concat(o.join("\n"),"\n"),c=a+n(267),u=a+n(268);let l=null;const h=r.createProgramInfo(this._gl,[c,u],null,null,(t=>{console.error(t);const e=t.match(/\*\*\* Error compiling shader: ([\s\S]+)/);l=e?e[1].trim():t}));if(!h)throw new Error("Failed to compile shader (mode ".concat(t,", effects ").concat(e,"): ").concat(l));return h}}i.EFFECT_INFO={color:{uniformName:"u_color",mask:1,converter:t=>t/200%1,shapeChanges:!1},fisheye:{uniformName:"u_fisheye",mask:2,converter:t=>Math.max(0,(t+100)/100),shapeChanges:!0},whirl:{uniformName:"u_whirl",mask:4,converter:t=>-t*Math.PI/180,shapeChanges:!0},pixelate:{uniformName:"u_pixelate",mask:8,converter:t=>Math.abs(t)/10,shapeChanges:!0},mosaic:{uniformName:"u_mosaic",mask:16,converter:t=>(t=Math.round((Math.abs(t)+10)/10),Math.max(1,Math.min(t,512))),shapeChanges:!0},brightness:{uniformName:"u_brightness",mask:32,converter:t=>Math.max(-100,Math.min(t,100))/100,shapeChanges:!1},ghost:{uniformName:"u_ghost",mask:64,converter:t=>1-Math.max(0,Math.min(t,100))/100,shapeChanges:!1}},i.EFFECTS=Object.keys(i.EFFECT_INFO),i.DRAW_MODE={default:"default",straightAlpha:"straightAlpha",silhouette:"silhouette",colorMask:"colorMask",line:"line",background:"background"},t.exports=i},function(t,e){const n="undefined"==typeof document,r=n?"[0m":"",i=n?"[90m":"",s=`${n?"[34m":""}debug${r}`,o=`${n?"[36m":""}info${r}`,a=`${n?"[33m":""}warn${r}`,c=`${n?"[31m":""}error${r}`,u=(t="")=>{const e=e=>u(t?`${t} ${e}`:e),n=t?[`${i}${t}${r}`]:[];return e.debug=e.log=console.debug.bind(console,...n,s),e.info=console.log.bind(console,...n,o),e.warn=e.warning=console.warn.bind(console,...n,a),e.error=console.error.bind(console,...n,c),e};u.enable=u.disable=()=>{},t.exports=u},function(t,e,n){const r=n(58);t.exports=class extends r{constructor(t,e,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;super(),this._socket=t.getScratchLinkSocket("BLE"),this._socket.setOnOpen(this.requestPeripheral.bind(this)),this._socket.setOnClose(this.handleDisconnectError.bind(this)),this._socket.setOnError(this._handleRequestError.bind(this)),this._socket.setHandleMessage(this._handleMessage.bind(this)),this._sendMessage=this._socket.sendMessage.bind(this._socket),this._availablePeripherals={},this._connectCallback=r,this._connected=!1,this._characteristicDidChangeCallback=null,this._resetCallback=i,this._discoverTimeoutID=null,this._extensionId=e,this._peripheralOptions=n,this._runtime=t,this._socket.open()}requestPeripheral(){this._availablePeripherals={},this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID),this._discoverTimeoutID=window.setTimeout(this._handleDiscoverTimeout.bind(this),15e3),this.sendRemoteRequest("discover",this._peripheralOptions).catch((t=>{this._handleRequestError(t)}))}connectPeripheral(t){this.sendRemoteRequest("connect",{peripheralId:t}).then((()=>{this._connected=!0,this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTED),this._connectCallback()})).catch((t=>{this._handleRequestError(t)}))}disconnect(){this._connected&&(this._connected=!1),this._socket.isOpen()&&this._socket.close(),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID),this._runtime.emit(this._runtime.constructor.PERIPHERAL_DISCONNECTED)}isConnected(){return this._connected}startNotifications(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const r={serviceId:t,characteristicId:e};return this._characteristicDidChangeCallback=n,this.sendRemoteRequest("startNotifications",r).catch((t=>{this.handleDisconnectError(t)}))}read(t,e){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const r={serviceId:t,characteristicId:e};return arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&(r.startNotifications=!0),n&&(this._characteristicDidChangeCallback=n),this.sendRemoteRequest("read",r).catch((t=>{this.handleDisconnectError(t)}))}write(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const s={serviceId:t,characteristicId:e,message:n};return r&&(s.encoding=r),null!==i&&(s.withResponse=i),this.sendRemoteRequest("write",s).catch((t=>{this.handleDisconnectError(t)}))}didReceiveCall(t,e){switch(t){case"didDiscoverPeripheral":this._availablePeripherals[e.peripheralId]=e,this._runtime.emit(this._runtime.constructor.PERIPHERAL_LIST_UPDATE,this._availablePeripherals),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID);break;case"userDidPickPeripheral":this._availablePeripherals[e.peripheralId]=e,this._runtime.emit(this._runtime.constructor.USER_PICKED_PERIPHERAL,this._availablePeripherals),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID);break;case"userDidNotPickPeripheral":this._runtime.emit(this._runtime.constructor.PERIPHERAL_SCAN_TIMEOUT),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID);break;case"characteristicDidChange":this._characteristicDidChangeCallback&&this._characteristicDidChangeCallback(e.message);break;case"ping":return 42}}handleDisconnectError(){this._connected&&(this.disconnect(),this._resetCallback&&this._resetCallback(),this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTION_LOST_ERROR,{message:"Scratch lost connection to",extensionId:this._extensionId}))}_handleRequestError(){this._runtime.emit(this._runtime.constructor.PERIPHERAL_REQUEST_ERROR,{message:"Scratch lost connection to",extensionId:this._extensionId})}_handleDiscoverTimeout(){this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID),this._runtime.emit(this._runtime.constructor.PERIPHERAL_SCAN_TIMEOUT)}}},function(t,e,n){const r=n(0);t.exports=function(t){if("string"!=typeof t){if(!Array.isArray(t))return r.error("Unexpected input recieved in replaceUnsafeChars"),t;t=String(t)}return t.replace(/[<>&'"]/g,(t=>{switch(t){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";case"'":return"&apos;";case'"':return"&quot;"}}))}},function(t,e,n){const r=n(6),i=n(0),s=function(t,e,n,r){return t.assetId=e.assetId,n.audioEngine?n.audioEngine.decodeSoundPlayer(Object.assign({},t,{data:e.data})).then((e=>{t.soundId=e.id;const i=e.buffer;return t.rate=i.sampleRate,t.sampleCount=i.length,null!==r&&r.addSoundPlayer(e),n.isPackaged&&(t.asset=null),t})):(i.warn("No audio engine present; cannot load sound asset: ",t.md5),Promise.resolve(t))},o=function(t,e,n){const r=t.asset,i=t.assetId,o=t.sampleCount,a=t.rate,c=t.format,u=t.dataFormat;return t.assetId=e.storage.defaultAssetId.Sound,t.asset=e.storage.get(t.assetId),t.md5="".concat(t.assetId,".").concat(t.asset.dataFormat),s(t,t.asset,e,n).then((t=>(t.broken={},t.broken.assetId=i,t.broken.md5="".concat(i,".").concat(u),t.broken.asset=r,t.broken.sampleCount=o,t.broken.rate=a,t.broken.format=c,t.broken.dataFormat=u,t)))};t.exports={loadSound:function(t,e,n){if(!e.storage)return i.warn("No storage module present; cannot load sound asset: ",t.md5),Promise.resolve(t);const a=r.splitFirst(t.md5,"."),c=a[0],u=a[1].toLowerCase();return t.dataFormat=u,(t.asset&&Promise.resolve(t.asset)||e.storage.load(e.storage.AssetType.Sound,c,u)).then((r=>(t.asset=r,r?s(t,r,e,n):(i.warn("Failed to find sound data: ",t.md5),o(t,e,n))))).catch((r=>(i.warn("Failed to load sound: ".concat(t.md5," with error: ").concat(r)),o(t,e,n))))},loadSoundFromAsset:s}},function(t,e,n){const r=n(6),i=n(0),s=n(71),{loadSvgString:o,serializeSvgToString:a}=n(23),{parseVectorMetadata:c}=n(78),u=function(t,e,n,r){return new Promise((i=>{let s=t.asset.decodeText();if(void 0===n){const e=c(s);e&&(n=e,t.rotationCenterX=n[0],t.rotationCenterY=n[1])}if(r&&2===r){const n=a(o(s,!0));if(s!==n){s=n;const r=e.storage;t.asset.encodeTextData(n,r.DataFormat.SVG,!0),t.assetId=t.asset.assetId,t.md5="".concat(t.assetId,".").concat(t.dataFormat)}}t.skinId=e.renderer.createSVGSkin(s,n),t.size=e.renderer.getSkinSize(t.skinId),n||(n=e.renderer.getSkinRotationCenter(t.skinId),t.rotationCenterX=n[0],t.rotationCenterY=n[1],t.bitmapResolution=1),e.isPackaged&&(t.asset=null),i(t)}))},l=new class{constructor(){this.pool=[],this.clearSoon=null}clear(){this.clearSoon||(this.clearSoon=new Promise((t=>setTimeout(t,1e3))).then((()=>{this.pool.length=0,this.clearSoon=null})))}create(){return this.pool.pop()||document.createElement("canvas")}release(t){this.clear(),this.pool.push(t)}},h=t=>new Promise(((e,n)=>{const r=new Image;r.onload=function(){e(r),r.onload=null,r.onerror=null},r.onerror=function(){n(new Error("Costume load failed. Asset could not be read.")),r.onload=null,r.onerror=null},r.src=t})),d=new s((async t=>{let e;for(let n=0;n<3;n++)try{if("function"==typeof createImageBitmap){const e=await createImageBitmap(new Blob([t.data.buffer],{type:t.assetType.contentType}));if(!e)throw new Error("createImageBitmap resolved with ".concat(e));return e}return await h(t.encodeDataURI())}catch(t){e||(e=t),i.warn(t),await new Promise((t=>setTimeout(t,2e3*Math.random())))}throw e}),25),p=function(t,e,n){return function(t,e,n){return t&&t.asset?e.v2BitmapAdapter?Promise.all([t.asset,t.textLayerAsset].map((t=>t?d.do(t):null))).then((r=>{let[i,s]=r;if(!i)throw new Error("Loading bitmap costume base failed.");const o=1===t.bitmapResolution?2:1;let a,c;if(s){c=l.create(),c.width=i.width,c.height=i.height;const t=c.getContext("2d");t.drawImage(i,0,0),t.drawImage(s,0,0),a=c}else a=i;return 1!==o&&(a=e.v2BitmapAdapter.resize(a,a.width*o,a.height*o),c&&l.release(c)),a.reusable=!1,n&&(n[0]=n[0]*o,n[1]=n[1]*o,t.rotationCenterX=n[0],t.rotationCenterY=n[1]),t.bitmapResolution=2,delete t.textLayerMD5,delete t.textLayerAsset,{image:a,rotationCenter:n,assetMatchesBase:1===o&&!s}})).finally((()=>{delete t.textLayerMD5,delete t.textLayerAsset})):Promise.reject("No V2 Bitmap adapter present."):Promise.reject("Costume load failed. Assets were missing.")}(t,e,n).then((n=>(n.assetMatchesBase||function(n){if(!e.v2BitmapAdapter)return Promise.reject("No V2 Bitmap adapter present.");const r=e.storage;t.asset=r.createAsset(r.AssetType.ImageBitmap,r.DataFormat.PNG,e.v2BitmapAdapter.convertDataURIToBinary(n),null,!0),t.dataFormat=r.DataFormat.PNG,t.assetId=t.asset.assetId,t.md5="".concat(t.assetId,".").concat(t.dataFormat)}((t=>{if(t instanceof HTMLCanvasElement)return t.toDataURL();const e=l.create();e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0);const n=e.toDataURL();return l.release(e),n})(n.image)),n))).then((n=>{let r,{image:i,rotationCenter:s}=n;s&&(r=[s[0]/2,s[1]/2]),t.skinId=e.renderer.createBitmapSkin(i,t.bitmapResolution,r);const o=e.renderer.getSkinSize(t.skinId);return t.size=[2*o[0],2*o[1]],s||(s=e.renderer.getSkinRotationCenter(t.skinId),t.rotationCenterX=2*s[0],t.rotationCenterY=2*s[1],t.bitmapResolution=2),e.isPackaged&&(t.asset=null),t}))},f=function(t,e){const n=t.asset,r=t.assetId,i=t.rotationCenterX,s=t.rotationCenterY,o=t.bitmapResolution,a=t.dataFormat,c=e.storage.AssetType,l=t.dataFormat===c.ImageVector.runtimeFormat;t.assetId=l?e.storage.defaultAssetId.ImageVector:e.storage.defaultAssetId.ImageBitmap,t.asset=e.storage.get(t.assetId),t.md5="".concat(t.assetId,".").concat(t.asset.dataFormat);return(l?u(t,e):p(t,e)).then((t=>(t.broken={},t.broken.assetId=r,t.broken.md5="".concat(r,".").concat(a),t.broken.asset=n,t.broken.dataFormat=a,t.broken.rotationCenterX=i,t.broken.rotationCenterY=s,t.broken.bitmapResolution=o,t)))},m=function(t,e,n){t.assetId=t.asset.assetId;if(!e.renderer)return i.warn("No rendering module present; cannot load costume: ",t.name),Promise.resolve(t);const r=e.storage.AssetType;let s;return"number"!=typeof t.rotationCenterX||isNaN(t.rotationCenterX)||"number"!=typeof t.rotationCenterY||isNaN(t.rotationCenterY)||(s=[t.rotationCenterX,t.rotationCenterY]),t.asset.assetType.runtimeFormat===r.ImageVector.runtimeFormat?u(t,e,s,n).catch((n=>(i.warn("Error loading vector image: ".concat(n)),f(t,e)))):p(t,e,s).catch((n=>(i.warn("Error loading bitmap image: ".concat(n)),f(t,e))))};t.exports={loadCostume:function(t,e,n,s){const o=r.splitFirst(t,"."),a=o[0],c=o[1].toLowerCase();if(e.dataFormat=c,e.asset)return m(e,n,s);if(!n.storage)return i.warn("No storage module present; cannot load costume asset: ",t),Promise.resolve(e);if(!n.storage.defaultAssetId)return i.warn("No default assets found"),Promise.resolve(e);const u=n.storage.AssetType,l="svg"===c?u.ImageVector:u.ImageBitmap,h=n.storage.load(l,a,c);let d;return d=e.textLayerMD5?n.storage.load(u.ImageBitmap,e.textLayerMD5,"png"):Promise.resolve(null),Promise.all([h,d]).then((t=>t[0]?(e.asset=t[0],t[1]&&(e.textLayerAsset=t[1]),m(e,n,s)):f(e,n))).catch((t=>(i.warn("Error loading costume: ",t),f(e,n))))},loadCostumeFromAsset:m}},function(t,e){t.exports={ID_NONE:-1,Events:{UseHighQualityRenderChanged:"UseHighQualityRenderChanged",AllowPrivateSkinAccessChanged:"AllowPrivateSkinAccessChanged",NativeSizeChanged:"NativeSizeChanged"}}},function(t,e,n){const r=n(27);r.enable(),t.exports=r("scratch-audioengine")},function(module,exports,__webpack_require__){(function(process,global){var __WEBPACK_AMD_DEFINE_RESULT__;(function(){"use strict";var ERROR="input is invalid type",WINDOW="object"==typeof window,root=WINDOW?window:{};root.JS_MD5_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&"object"==typeof self,NODE_JS=!root.JS_MD5_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_MD5_NO_COMMON_JS&&"object"==typeof module&&module.exports,AMD=__webpack_require__(254),ARRAY_BUFFER=!root.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[128,32768,8388608,-2147483648],SHIFT=[0,8,16,24],OUTPUT_TYPES=["hex","array","digest","buffer","arrayBuffer","base64"],BASE64_ENCODE_CHAR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),blocks=[],buffer8;if(ARRAY_BUFFER){var buffer=new ArrayBuffer(68);buffer8=new Uint8Array(buffer),blocks=new Uint32Array(buffer)}!root.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!ARRAY_BUFFER||!root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var createOutputMethod=function(t){return function(e){return new Md5(!0).update(e)[t]()}},createMethod=function(){var t=createOutputMethod("hex");NODE_JS&&(t=nodeWrap(t)),t.create=function(){return new Md5},t.update=function(e){return t.create().update(e)};for(var e=0;e<OUTPUT_TYPES.length;++e){var n=OUTPUT_TYPES[e];t[n]=createOutputMethod(n)}return t},nodeWrap=function(method){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),nodeMethod=function(t){if("string"==typeof t)return crypto.createHash("md5").update(t,"utf8").digest("hex");if(null==t)throw ERROR;return t.constructor===ArrayBuffer&&(t=new Uint8Array(t)),Array.isArray(t)||ArrayBuffer.isView(t)||t.constructor===Buffer?crypto.createHash("md5").update(new Buffer(t)).digest("hex"):method(t)};return nodeMethod};function Md5(t){if(t)blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks,this.buffer8=buffer8;else if(ARRAY_BUFFER){var e=new ArrayBuffer(68);this.buffer8=new Uint8Array(e),this.blocks=new Uint32Array(e)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}Md5.prototype.update=function(t){if(!this.finalized){var e,n=typeof t;if("string"!==n){if("object"!==n)throw ERROR;if(null===t)throw ERROR;if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||ARRAY_BUFFER&&ArrayBuffer.isView(t)))throw ERROR;e=!0}for(var r,i,s=0,o=t.length,a=this.blocks,c=this.buffer8;s<o;){if(this.hashed&&(this.hashed=!1,a[0]=a[16],a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),e)if(ARRAY_BUFFER)for(i=this.start;s<o&&i<64;++s)c[i++]=t[s];else for(i=this.start;s<o&&i<64;++s)a[i>>2]|=t[s]<<SHIFT[3&i++];else if(ARRAY_BUFFER)for(i=this.start;s<o&&i<64;++s)(r=t.charCodeAt(s))<128?c[i++]=r:r<2048?(c[i++]=192|r>>6,c[i++]=128|63&r):r<55296||r>=57344?(c[i++]=224|r>>12,c[i++]=128|r>>6&63,c[i++]=128|63&r):(r=65536+((1023&r)<<10|1023&t.charCodeAt(++s)),c[i++]=240|r>>18,c[i++]=128|r>>12&63,c[i++]=128|r>>6&63,c[i++]=128|63&r);else for(i=this.start;s<o&&i<64;++s)(r=t.charCodeAt(s))<128?a[i>>2]|=r<<SHIFT[3&i++]:r<2048?(a[i>>2]|=(192|r>>6)<<SHIFT[3&i++],a[i>>2]|=(128|63&r)<<SHIFT[3&i++]):r<55296||r>=57344?(a[i>>2]|=(224|r>>12)<<SHIFT[3&i++],a[i>>2]|=(128|r>>6&63)<<SHIFT[3&i++],a[i>>2]|=(128|63&r)<<SHIFT[3&i++]):(r=65536+((1023&r)<<10|1023&t.charCodeAt(++s)),a[i>>2]|=(240|r>>18)<<SHIFT[3&i++],a[i>>2]|=(128|r>>12&63)<<SHIFT[3&i++],a[i>>2]|=(128|r>>6&63)<<SHIFT[3&i++],a[i>>2]|=(128|63&r)<<SHIFT[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},Md5.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[e>>2]|=EXTRA[3&e],e>=56&&(this.hashed||this.hash(),t[0]=t[16],t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.bytes<<3,t[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},Md5.prototype.hash=function(){var t,e,n,r,i,s,o=this.blocks;this.first?e=((e=((t=((t=o[0]-680876937)<<7|t>>>25)-271733879|0)^(n=((n=(-271733879^(r=((r=(-1732584194^2004318071&t)+o[1]-117830708)<<12|r>>>20)+t|0)&(-271733879^t))+o[2]-1126478375)<<17|n>>>15)+r|0)&(r^t))+o[3]-1316259209)<<22|e>>>10)+n|0:(t=this.h0,e=this.h1,n=this.h2,e=((e+=((t=((t+=((r=this.h3)^e&(n^r))+o[0]-680876936)<<7|t>>>25)+e|0)^(n=((n+=(e^(r=((r+=(n^t&(e^n))+o[1]-389564586)<<12|r>>>20)+t|0)&(t^e))+o[2]+606105819)<<17|n>>>15)+r|0)&(r^t))+o[3]-1044525330)<<22|e>>>10)+n|0),e=((e+=((t=((t+=(r^e&(n^r))+o[4]-176418897)<<7|t>>>25)+e|0)^(n=((n+=(e^(r=((r+=(n^t&(e^n))+o[5]+1200080426)<<12|r>>>20)+t|0)&(t^e))+o[6]-1473231341)<<17|n>>>15)+r|0)&(r^t))+o[7]-45705983)<<22|e>>>10)+n|0,e=((e+=((t=((t+=(r^e&(n^r))+o[8]+1770035416)<<7|t>>>25)+e|0)^(n=((n+=(e^(r=((r+=(n^t&(e^n))+o[9]-1958414417)<<12|r>>>20)+t|0)&(t^e))+o[10]-42063)<<17|n>>>15)+r|0)&(r^t))+o[11]-1990404162)<<22|e>>>10)+n|0,e=((e+=((t=((t+=(r^e&(n^r))+o[12]+1804603682)<<7|t>>>25)+e|0)^(n=((n+=(e^(r=((r+=(n^t&(e^n))+o[13]-40341101)<<12|r>>>20)+t|0)&(t^e))+o[14]-1502002290)<<17|n>>>15)+r|0)&(r^t))+o[15]+1236535329)<<22|e>>>10)+n|0,e=((e+=((r=((r+=(e^n&((t=((t+=(n^r&(e^n))+o[1]-165796510)<<5|t>>>27)+e|0)^e))+o[6]-1069501632)<<9|r>>>23)+t|0)^t&((n=((n+=(t^e&(r^t))+o[11]+643717713)<<14|n>>>18)+r|0)^r))+o[0]-373897302)<<20|e>>>12)+n|0,e=((e+=((r=((r+=(e^n&((t=((t+=(n^r&(e^n))+o[5]-701558691)<<5|t>>>27)+e|0)^e))+o[10]+38016083)<<9|r>>>23)+t|0)^t&((n=((n+=(t^e&(r^t))+o[15]-660478335)<<14|n>>>18)+r|0)^r))+o[4]-405537848)<<20|e>>>12)+n|0,e=((e+=((r=((r+=(e^n&((t=((t+=(n^r&(e^n))+o[9]+568446438)<<5|t>>>27)+e|0)^e))+o[14]-1019803690)<<9|r>>>23)+t|0)^t&((n=((n+=(t^e&(r^t))+o[3]-187363961)<<14|n>>>18)+r|0)^r))+o[8]+1163531501)<<20|e>>>12)+n|0,e=((e+=((r=((r+=(e^n&((t=((t+=(n^r&(e^n))+o[13]-1444681467)<<5|t>>>27)+e|0)^e))+o[2]-51403784)<<9|r>>>23)+t|0)^t&((n=((n+=(t^e&(r^t))+o[7]+1735328473)<<14|n>>>18)+r|0)^r))+o[12]-1926607734)<<20|e>>>12)+n|0,e=((e+=((s=(r=((r+=((i=e^n)^(t=((t+=(i^r)+o[5]-378558)<<4|t>>>28)+e|0))+o[8]-2022574463)<<11|r>>>21)+t|0)^t)^(n=((n+=(s^e)+o[11]+1839030562)<<16|n>>>16)+r|0))+o[14]-35309556)<<23|e>>>9)+n|0,e=((e+=((s=(r=((r+=((i=e^n)^(t=((t+=(i^r)+o[1]-1530992060)<<4|t>>>28)+e|0))+o[4]+1272893353)<<11|r>>>21)+t|0)^t)^(n=((n+=(s^e)+o[7]-155497632)<<16|n>>>16)+r|0))+o[10]-1094730640)<<23|e>>>9)+n|0,e=((e+=((s=(r=((r+=((i=e^n)^(t=((t+=(i^r)+o[13]+681279174)<<4|t>>>28)+e|0))+o[0]-358537222)<<11|r>>>21)+t|0)^t)^(n=((n+=(s^e)+o[3]-722521979)<<16|n>>>16)+r|0))+o[6]+76029189)<<23|e>>>9)+n|0,e=((e+=((s=(r=((r+=((i=e^n)^(t=((t+=(i^r)+o[9]-640364487)<<4|t>>>28)+e|0))+o[12]-421815835)<<11|r>>>21)+t|0)^t)^(n=((n+=(s^e)+o[15]+530742520)<<16|n>>>16)+r|0))+o[2]-995338651)<<23|e>>>9)+n|0,e=((e+=((r=((r+=(e^((t=((t+=(n^(e|~r))+o[0]-198630844)<<6|t>>>26)+e|0)|~n))+o[7]+1126891415)<<10|r>>>22)+t|0)^((n=((n+=(t^(r|~e))+o[14]-1416354905)<<15|n>>>17)+r|0)|~t))+o[5]-57434055)<<21|e>>>11)+n|0,e=((e+=((r=((r+=(e^((t=((t+=(n^(e|~r))+o[12]+1700485571)<<6|t>>>26)+e|0)|~n))+o[3]-1894986606)<<10|r>>>22)+t|0)^((n=((n+=(t^(r|~e))+o[10]-1051523)<<15|n>>>17)+r|0)|~t))+o[1]-2054922799)<<21|e>>>11)+n|0,e=((e+=((r=((r+=(e^((t=((t+=(n^(e|~r))+o[8]+1873313359)<<6|t>>>26)+e|0)|~n))+o[15]-30611744)<<10|r>>>22)+t|0)^((n=((n+=(t^(r|~e))+o[6]-1560198380)<<15|n>>>17)+r|0)|~t))+o[13]+1309151649)<<21|e>>>11)+n|0,e=((e+=((r=((r+=(e^((t=((t+=(n^(e|~r))+o[4]-145523070)<<6|t>>>26)+e|0)|~n))+o[11]-1120210379)<<10|r>>>22)+t|0)^((n=((n+=(t^(r|~e))+o[2]+718787259)<<15|n>>>17)+r|0)|~t))+o[9]-343485551)<<21|e>>>11)+n|0,this.first?(this.h0=t+1732584193|0,this.h1=e-271733879|0,this.h2=n-1732584194|0,this.h3=r+271733878|0,this.first=!1):(this.h0=this.h0+t|0,this.h1=this.h1+e|0,this.h2=this.h2+n|0,this.h3=this.h3+r|0)},Md5.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,r=this.h3;return HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]},Md5.prototype.toString=Md5.prototype.hex,Md5.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,r=this.h3;return[255&t,t>>8&255,t>>16&255,t>>24&255,255&e,e>>8&255,e>>16&255,e>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255]},Md5.prototype.array=Md5.prototype.digest,Md5.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(16),e=new Uint32Array(t);return e[0]=this.h0,e[1]=this.h1,e[2]=this.h2,e[3]=this.h3,t},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var t,e,n,r="",i=this.array(),s=0;s<15;)t=i[s++],e=i[s++],n=i[s++],r+=BASE64_ENCODE_CHAR[t>>>2]+BASE64_ENCODE_CHAR[63&(t<<4|e>>>4)]+BASE64_ENCODE_CHAR[63&(e<<2|n>>>6)]+BASE64_ENCODE_CHAR[63&n];return t=i[s],r+=BASE64_ENCODE_CHAR[t>>>2]+BASE64_ENCODE_CHAR[t<<4&63]+"=="};var exports=createMethod();COMMON_JS?module.exports=exports:(root.md5=exports,AMD&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return exports}.call(exports,__webpack_require__,exports,module),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))})()}).call(this,__webpack_require__(35),__webpack_require__(8))},function(t,e){var n,r,i=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(t){n=s}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(t){r=o}}();var c,u=[],l=!1,h=-1;function d(){l&&c&&(l=!1,c.length?u=c.concat(u):h=-1,u.length&&p())}function p(){if(!l){var t=a(d);l=!0;for(var e=u.length;e;){for(c=u,u=[];++h<e;)c&&c[h].run();h=-1,e=u.length}c=null,l=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{return r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function f(t,e){this.fun=t,this.array=e}function m(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new f(t,e)),1!==u.length||l||a(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e){t.exports={SPRITE:"sprite",STAGE:"stage"}},function(t,e,n){const r=n(13);t.exports=class{constructor(t){this._maxTokens=t,this._refillInterval=1e3/t,this._count=this._maxTokens,this._timer=new r,this._timer.start(),this._lastUpdateTime=this._timer.timeElapsed()}okayToSend(){const t=this._timer.timeElapsed(),e=t-this._lastUpdateTime,n=Math.floor(e/this._refillInterval);return n>0&&(this._lastUpdateTime=t),this._count=Math.min(this._maxTokens,this._count+n),this._count>0&&(this._count--,!0)}}},function(t,e,n){(function(e){let n=e.fetch;t.exports={fetchWithTimeout:(t,e,r)=>{let i=null;const s=window.AbortController?new window.AbortController:null,o=s?s.signal:null;return Promise.race([n(t,Object.assign({signal:o},e)).then((t=>(clearTimeout(i),t)),(t=>{throw clearTimeout(i),t})),new Promise(((t,e)=>{i=setTimeout((()=>{s&&s.abort(),e(new Error("Fetch timed out after ".concat(r," ms")))}),r)}))])},setFetch:t=>{n=t}}}).call(this,n(8))},function(t,e,n){function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}const s=n(17),{OrderedMap:o}=n(21),a=n(60),c=n(296),u=n(3),l=n(15),h=n(64),d=n(2),p=n(184),f=n(185),m=n(44),g=n(43),b=n(68),y=n(36),v=n(22),w=n(0),T=n(54),E=n(12),A=n(9),k=n(29),I=n(191),S=n(192),x=n(38),O=n(194),M=n(195),N=n(196),C=n(197),R=n(198),D=n(199),P=n(200),L=n(69),B=n(6),U=n(7),j={scratch3_control:n(201),scratch3_event:n(202),scratch3_looks:n(203),scratch3_motion:n(204),scratch3_operators:n(205),scratch3_sound:n(206),scratch3_sensing:n(207),scratch3_data:n(208),scratch3_procedures:n(209)},F=n(210),z=n(211),V=["#0FBD8C","#0DA57A","#0B8E69"],G=" // _twconfig_",Y=(()=>{const t={};return t[u.ANGLE]={shadow:{type:"math_angle",fieldName:"NUM"}},t[u.COLOR]={shadow:{type:"colour_picker",fieldName:"COLOUR"}},t[u.NUMBER]={shadow:{type:"math_number",fieldName:"NUM"}},t[u.STRING]={shadow:{type:"text",fieldName:"TEXT"}},t[u.BOOLEAN]={check:"Boolean"},t[u.MATRIX]={shadow:{type:"matrix",fieldName:"MATRIX"}},t[u.NOTE]={shadow:{type:"note",fieldName:"NOTE"}},t[u.IMAGE]={fieldType:"field_image"},t[u.COSTUME]={shadow:{type:"looks_costume",fieldName:"COSTUME"}},t[u.SOUND]={shadow:{type:"sound_sounds_menu",fieldName:"SOUND_MENU"}},t})(),H=t=>{let e=0;return{canAddCloudVariable:()=>e<t.limit,addCloudVariable:()=>{e++},removeCloudVariable:()=>{e--},hasCloudVariables:()=>e>0,getNumberOfCloudVariables:()=>e}};let W=-1,K=-1,q=-1;class Q extends s{constructor(){super(),this.targets=[],this.executableTargets=[],this.threads=[],this.threadMap=new Map,this.sequencer=new f(this),this.flyoutBlocks=new l(this,!0),this.monitorBlocks=new l(this,!0),this._editingTarget=null,this._primitives={},this._blockInfo=[],this._hats={},this._flowing={},this._scriptGlowsPreviousFrame=[],this._nonMonitorThreadCount=0,this._lastStepDoneThreads=null,this._cloneCounter=0,this._refreshTargets=!1,this.monitorBlockInfo={},this._monitorState=o({}),this._prevMonitorState=o({}),this.turboMode=!1,this.frameLoop=new z(this),this.currentStepTime=1e3/30,this.updateCurrentMSecs(),this.redrawRequested=!1,this._registerBlockPackages(),this.ioDevices={clock:new M(this),cloud:new N(this),keyboard:new C(this),mouse:new R(this),mouseWheel:new D(this),userData:new P,video:new L(this)},this.peripheralExtensions={},this.profiler=null,this.cloudOptions={limit:10};const t=H(this.cloudOptions);this.hasCloudData=t.hasCloudVariables,this.canAddCloudVariable=t.canAddCloudVariable,this.getNumberOfCloudVariables=t.getNumberOfCloudVariables,this.addCloudVariable=this._initializeAddCloudVariable(t),this.removeCloudVariable=this._initializeRemoveCloudVariable(t),this.origin=null,this.platform=Object.assign({},O),this._initScratchLink(),this.resetRunId(),this._stageTarget=null,this.addonBlocks={},this.stageWidth=Q.STAGE_WIDTH,this.stageHeight=Q.STAGE_HEIGHT,this.runtimeOptions={maxClones:Q.MAX_CLONES,miscLimits:!0,fencing:!0},this.compilerOptions={enabled:!0,warpTimer:!1},this.debug=!1,this._lastStepTime=Date.now(),this.interpolationEnabled=!1,this._defaultStoredSettings=this._generateAllProjectOptions(),this.isPackaged=!1,this.externalCommunicationMethods={cloudVariables:!1,customExtensions:!1},this.on(Q.HAS_CLOUD_DATA_UPDATE,(t=>{this.setExternalCommunicationMethod("cloudVariables",t)})),this.enforcePrivacy=!0,this.extensionButtons=new Map,this.fontManager=new S(this),this.extensionStorage={},this.totalAssetRequests=0,this.finishedAssetRequests=0}static get STAGE_WIDTH(){return 480}static get STAGE_HEIGHT(){return 360}static get SCRIPT_GLOW_ON(){return"SCRIPT_GLOW_ON"}static get SCRIPT_GLOW_OFF(){return"SCRIPT_GLOW_OFF"}static get BLOCK_GLOW_ON(){return"BLOCK_GLOW_ON"}static get BLOCK_GLOW_OFF(){return"BLOCK_GLOW_OFF"}static get HAS_CLOUD_DATA_UPDATE(){return"HAS_CLOUD_DATA_UPDATE"}static get TURBO_MODE_ON(){return"TURBO_MODE_ON"}static get TURBO_MODE_OFF(){return"TURBO_MODE_OFF"}static get RUNTIME_OPTIONS_CHANGED(){return"RUNTIME_OPTIONS_CHANGED"}static get COMPILER_OPTIONS_CHANGED(){return"COMPILER_OPTIONS_CHANGED"}static get FRAMERATE_CHANGED(){return"FRAMERATE_CHANGED"}static get INTERPOLATION_CHANGED(){return"INTERPOLATION_CHANGED"}static get STAGE_SIZE_CHANGED(){return"STAGE_SIZE_CHANGED"}static get COMPILE_ERROR(){return"COMPILE_ERROR"}static get BEFORE_EXECUTE(){return"BEFORE_EXECUTE"}static get AFTER_EXECUTE(){return"AFTER_EXECUTE"}static get ASSET_PROGRESS(){return"ASSET_PROGRESS"}static get PROJECT_START(){return"PROJECT_START"}static get PROJECT_RUN_START(){return"PROJECT_RUN_START"}static get PROJECT_RUN_STOP(){return"PROJECT_RUN_STOP"}static get PROJECT_STOP_ALL(){return"PROJECT_STOP_ALL"}static get STOP_FOR_TARGET(){return"STOP_FOR_TARGET"}static get VISUAL_REPORT(){return"VISUAL_REPORT"}static get PROJECT_LOADED(){return"PROJECT_LOADED"}static get PROJECT_CHANGED(){return"PROJECT_CHANGED"}static get TOOLBOX_EXTENSIONS_NEED_UPDATE(){return"TOOLBOX_EXTENSIONS_NEED_UPDATE"}static get TARGETS_UPDATE(){return"TARGETS_UPDATE"}static get MONITORS_UPDATE(){return"MONITORS_UPDATE"}static get BLOCK_DRAG_UPDATE(){return"BLOCK_DRAG_UPDATE"}static get BLOCK_DRAG_END(){return"BLOCK_DRAG_END"}static get EXTENSION_ADDED(){return"EXTENSION_ADDED"}static get EXTENSION_FIELD_ADDED(){return"EXTENSION_FIELD_ADDED"}static get PERIPHERAL_LIST_UPDATE(){return"PERIPHERAL_LIST_UPDATE"}static get USER_PICKED_PERIPHERAL(){return"USER_PICKED_PERIPHERAL"}static get PERIPHERAL_CONNECTED(){return"PERIPHERAL_CONNECTED"}static get PERIPHERAL_DISCONNECTED(){return"PERIPHERAL_DISCONNECTED"}static get PERIPHERAL_REQUEST_ERROR(){return"PERIPHERAL_REQUEST_ERROR"}static get PERIPHERAL_CONNECTION_LOST_ERROR(){return"PERIPHERAL_CONNECTION_LOST_ERROR"}static get PERIPHERAL_SCAN_TIMEOUT(){return"PERIPHERAL_SCAN_TIMEOUT"}static get MIC_LISTENING(){return"MIC_LISTENING"}static get BLOCKSINFO_UPDATE(){return"BLOCKSINFO_UPDATE"}static get RUNTIME_STARTED(){return"RUNTIME_STARTED"}static get RUNTIME_STOPPED(){return"RUNTIME_STOPPED"}static get RUNTIME_DISPOSED(){return"RUNTIME_DISPOSED"}static get BLOCKS_NEED_UPDATE(){return"BLOCKS_NEED_UPDATE"}static get PLATFORM_MISMATCH(){return"PLATFORM_MISMATCH"}static get THREAD_STEP_INTERVAL(){return 1e3/60}static get THREAD_STEP_INTERVAL_COMPATIBILITY(){return 1e3/30}static get MAX_CLONES(){return 300}_initializeAddCloudVariable(t){return()=>{const e=this.hasCloudData();t.addCloudVariable(),!e&&this.hasCloudData()&&this.emit(Q.HAS_CLOUD_DATA_UPDATE,!0)}}_initializeRemoveCloudVariable(t){return()=>{const e=this.hasCloudData();t.removeCloudVariable(),e&&!this.hasCloudData()&&this.emit(Q.HAS_CLOUD_DATA_UPDATE,!1)}}_registerBlockPackages(){for(const t in j)if(Object.prototype.hasOwnProperty.call(j,t)){const e=new j[t](this);if(e.getPrimitives){const t=e.getPrimitives();for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(this._primitives[n]=t[n].bind(e))}if(e.getHats){const t=e.getHats();for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this._hats[e]=t[e])}e.getMonitored&&(this.monitorBlockInfo=Object.assign({},this.monitorBlockInfo,e.getMonitored())),this.compilerRegisterExtension(t,e)}}compilerRegisterExtension(t,e){this["ext_".concat(t)]=e}getMonitorState(){return this._monitorState}_makeExtensionMenuId(t,e){return"".concat(e,"_menu_").concat(t)}makeMessageContextForTarget(t){const e={};(t=t||this.getEditingTarget()||this.getTargetForStage())&&(e.targetType=t.isStage?y.STAGE:y.SPRITE)}_registerExtensionPrimitives(t){const e={id:t.id,name:T(t.name),showStatusButton:t.showStatusButton,blockIconURI:t.blockIconURI,menuIconURI:t.menuIconURI};t.color1?(e.color1=t.color1,e.color2=t.color2,e.color3=t.color3):(e.color1=V[0],e.color2=V[1],e.color3=V[2]),this._blockInfo.push(e),this._fillExtensionCategory(e,t);for(const n in e.customFieldTypes)if(Object.prototype.hasOwnProperty.call(t.customFieldTypes,n)){const t=e.customFieldTypes[n];this.emit(Q.EXTENSION_FIELD_ADDED,{name:"field_".concat(t.extendedName),implementation:t.fieldImplementation})}this.emit(Q.EXTENSION_ADDED,e)}_refreshExtensionPrimitives(t){const e=this._blockInfo.find((e=>e.id===t.id));e&&(e.name=T(t.name),this._fillExtensionCategory(e,t),this.emit(Q.BLOCKSINFO_UPDATE,e))}_fillExtensionCategory(t,e){t.blocks=[],t.customFieldTypes={},t.menus=[],t.menuInfo={};for(const n in e.menus)if(Object.prototype.hasOwnProperty.call(e.menus,n)){const r=e.menus[n],i=this._buildMenuForScratchBlocks(n,r,t);t.menus.push(i),t.menuInfo[n]=r}for(const n in e.customFieldTypes)if(Object.prototype.hasOwnProperty.call(e.customFieldTypes,n)){const r=e.customFieldTypes[n],i=this._buildCustomFieldInfo(n,r,e.id,t);t.customFieldTypes[n]=i}if(e.docsURI){const n={info:{},xml:"<button "+'text="'.concat(k(T({id:"tw.blocks.openDocs",default:"Open Documentation",description:"Button that opens site with more documentation about an extension"})),'" ')+'callbackKey="OPEN_EXTENSION_DOCS" '+'callbackData="'.concat(k(e.docsURI),'"></button>')};t.blocks.push(n)}for(const n of e.blocks)try{const e=this._convertForScratchBlocks(n,t);if(t.blocks.push(e),e.json){const t=e.json.type;n.blockType!==d.EVENT&&(this._primitives[t]=e.info.func),n.blockType===d.EVENT||n.blockType===d.HAT?this._hats[t]={edgeActivated:n.isEdgeActivated,restartExistingThreads:n.shouldRestartExistingThreads}:n.blockType===d.CONDITIONAL?this._flowing[t]={conditional:!0,loop:!1}:n.blockType===d.LOOP&&(this._flowing[t]={conditional:!1,loop:!0})}}catch(t){w.error("Error parsing block: ",{block:n,error:t})}}_convertMenuItems(t){if("function"!=typeof t){const e=this.makeMessageContextForTarget();return t.map((t=>{const n=T(t,e);switch(typeof n){case"string":return[n,n];case"object":return[T(t.text,e),t.value];default:throw new Error("Can't interpret menu item: ".concat(JSON.stringify(t)))}}))}return t}_buildMenuForScratchBlocks(t,e,n){const r=this._makeExtensionMenuId(t,n.id),i=this._convertMenuItems(e.items);return{json:{message0:"%1",type:r,inputsInline:!0,output:"String",colour:n.color1,colourSecondary:n.color2,colourTertiary:n.color3,outputShape:e.acceptReporters?b.OUTPUT_SHAPE_ROUND:b.OUTPUT_SHAPE_SQUARE,args0:[{type:"field_dropdown",name:t,options:i}]}}}_buildCustomFieldInfo(t,e,n,r){const i="".concat(n,"_").concat(t);return{fieldName:t,extendedName:i,argumentTypeInfo:{shadow:{type:i,fieldName:"field_".concat(i)}},scratchBlocksDefinition:this._buildCustomFieldTypeForScratchBlocks(i,e.output,e.outputShape,r),fieldImplementation:e.implementation}}_buildCustomFieldTypeForScratchBlocks(t,e,n,r){return{json:{type:t,message0:"%1",inputsInline:!0,output:e,colour:r.color1,colourSecondary:r.color2,colourTertiary:r.color3,outputShape:n,args0:[{name:"field_".concat(t),type:"field_".concat(t)}]}}}_convertForScratchBlocks(t,e){return"---"===t?this._convertSeparatorForScratchBlocks(t):t.blockType===d.LABEL?this._convertLabelForScratchBlocks(t):t.blockType===d.BUTTON?this._convertButtonForScratchBlocks(t,e):t.blockType===d.XML?this._convertXmlForScratchBlocks(t):this._convertBlockForScratchBlocks(t,e)}_convertBlockForScratchBlocks(t,e){var n,r,i;const s="".concat(e.id,"_").concat(t.opcode),o={type:s,inputsInline:!0,category:e.name,extensions:[],colour:null!==(n=t.color1)&&void 0!==n?n:e.color1,colourSecondary:null!==(r=t.color2)&&void 0!==r?r:e.color2,colourTertiary:null!==(i=t.color3)&&void 0!==i?i:e.color3},a={argsMap:{},blockJSON:o,categoryInfo:e,blockInfo:t,inputList:[]},c=t.blockIconURI||e.blockIconURI;if(o.extensions.push("from_extension"),o.colour===V[0]&&o.colourSecondary===V[1]&&o.colourTertiary===V[2]&&o.extensions.push("default_extension_colors"),c){o.extensions.push("scratch_extension"),o.message0="%1 %2";const t={type:"field_image",src:c,width:40,height:40},e={type:"field_vertical_separator"};o.args0=[t,e]}switch(t.blockType){case d.COMMAND:o.outputShape=b.OUTPUT_SHAPE_SQUARE,o.previousStatement=null,t.isTerminal||(o.nextStatement=null);break;case d.REPORTER:o.output=t.allowDropAnywhere?null:"String",o.outputShape=b.OUTPUT_SHAPE_ROUND;break;case d.BOOLEAN:o.output="Boolean",o.outputShape=b.OUTPUT_SHAPE_HEXAGONAL;break;case d.HAT:case d.EVENT:Object.prototype.hasOwnProperty.call(t,"isEdgeActivated")||(t.isEdgeActivated=!0),o.outputShape=b.OUTPUT_SHAPE_SQUARE,o.nextStatement=null;break;case d.CONDITIONAL:case d.LOOP:t.branchCount=t.branchCount||1,o.outputShape=b.OUTPUT_SHAPE_SQUARE,o.previousStatement=null,t.isTerminal||(o.nextStatement=null)}t.blockShape&&(o.outputShape=t.blockShape);const u=Array.isArray(t.text)?t.text:[t.text];let l=0,h=0,p=0;const f=this._convertPlaceholders.bind(this,a),m=this.makeMessageContextForTarget();for(;l<u.length||h<t.branchCount;){if(l<u.length){a.outLineNum=p;const t=T(u[l],m).replace(/\[(.+?)]/g,f);o["message".concat(p)]?o["message".concat(p)]+=t:o["message".concat(p)]=t,++l,++p}h<t.branchCount&&(o["message".concat(p)]="%1",o["args".concat(p)]=[{type:"input_statement",name:"SUBSTACK".concat(h>0?h+1:"")}],++h,++p)}if(t.blockType===d.REPORTER||t.blockType===d.BOOLEAN)t.disableMonitor||0!==a.inputList.length||(o.checkboxInFlyout=!0);else if(t.branchIconURI||t.blockType===d.LOOP&&!Object.prototype.hasOwnProperty.call(t,"branchIconURI")){var g;o["lastDummyAlign".concat(p)]="RIGHT",o["message".concat(p)]="%1",o["args".concat(p)]=[{type:"field_image",src:null!==(g=t.branchIconURI)&&void 0!==g?g:"media://repeat.svg",width:24,height:24,alt:"*",flip_rtl:!0}],++p}const y=t.isDynamic?'<mutation blockInfo="'.concat(k(JSON.stringify(t)),'"/>'):"",v=a.inputList.join(""),w='<block type="'.concat(k(s),'">').concat(y).concat(v,"</block>");if(t.extensions)for(const e of t.extensions)o.extensions.includes(e)||o.extensions.push(e);return{info:a.blockInfo,json:a.blockJSON,xml:w}}_convertSeparatorForScratchBlocks(t){return{info:t,xml:'<sep gap="36"/>'}}_convertLabelForScratchBlocks(t){return{info:t,xml:'<label text="'.concat(k(t.text),'"></label>')}}_convertButtonForScratchBlocks(t,e){const n=this.makeMessageContextForTarget(),r=T(t.text,n);if(["MAKE_A_LIST","MAKE_A_PROCEDURE","MAKE_A_VARIABLE"].includes(t.func))return{info:t,xml:'<button text="'.concat(k(r),'" callbackKey="').concat(k(t.func),'"></button>')};const i="".concat(e.id,"_").concat(t.func);return this.extensionButtons.set(i,t.callFunc),{info:t,xml:'<button text="'.concat(k(r),'"')+' callbackKey="EXTENSION_CALLBACK"'+' callbackData="'.concat(k(i),'"></button>')}}_convertXmlForScratchBlocks(t){return{info:t,xml:t.xml}}handleExtensionButtonPress(t){this.extensionButtons.get(t)()}_constructInlineImageJson(t){return t.dataURI||w.warn("Missing data URI in extension block with argument type IMAGE"),{type:"field_image",src:t.dataURI||"",width:24,height:24,flip_rtl:t.flipRTL||!1}}_convertPlaceholders(t,e,n){const r=t.blockInfo.arguments[n]||{};let i,s=Y[r.type]||{};if(!Y[r.type]&&t.categoryInfo.customFieldTypes[r.type]&&(s=t.categoryInfo.customFieldTypes[r.type].argumentTypeInfo),"field_image"===s.fieldType)i=this._constructInlineImageJson(r);else{i={type:"input_value",name:n};const e=void 0===r.defaultValue?null:T(r.defaultValue,this.makeMessageContextForTarget()).toString();let o,a,c;if(s.check&&(i.check=s.check),r.menu){const e=t.categoryInfo.menuInfo[r.menu];e.acceptReporters?(o=n,a=this._makeExtensionMenuId(r.menu,t.categoryInfo.id),c=r.menu):(i.type="field_dropdown",i.options=this._convertMenuItems(e.items),o=null,a=null,c=n)}else o=n,a=s.shadow&&s.shadow.type||null,c=s.shadow&&s.shadow.fieldName||null;o&&t.inputList.push('<value name="'.concat(k(n),'">')),a&&t.inputList.push('<shadow type="'.concat(k(a),'">')),null!==e&&c&&t.inputList.push('<field name="'.concat(k(c),'">').concat(k(e),"</field>")),a&&t.inputList.push("</shadow>"),o&&t.inputList.push("</value>")}const o="args".concat(t.outLineNum),a=t.blockJSON[o]=t.blockJSON[o]||[];i&&a.push(i);const c=a.length;return t.argsMap[n]=c,"%".concat(c)}getBlocksXML(t){return this._blockInfo.map((e=>{const{name:n,color1:r,color2:i}=e,s=e.blocks.filter((e=>{let n=!0;return t&&e.info.filter&&(n=e.info.filter.includes(t.isStage?y.STAGE:y.SPRITE)),n&&!e.info.hideFromPalette})),o='colour="'.concat(k(r),'" secondaryColour="').concat(k(i),'"');let a="";e.menuIconURI?a=e.menuIconURI:e.blockIconURI&&(a=e.blockIconURI);const c=a?'iconURI="'.concat(k(a),'"'):"";let u="";e.showStatusButton&&(u='showStatusButton="true"');let l='<category name="'.concat(k(n),'"');return l+=' id="'.concat(k(e.id),'"'),l+=" ".concat(u),l+=" ".concat(o),l+=" ".concat(c,">"),l+=s.map((t=>t.xml)).join(""),l+="</category>",{id:e.id,xml:l}}))}getBlocksJSON(){return this._blockInfo.reduce(((t,e)=>t.concat(e.blocks.map((t=>t.json)))),[])}_initScratchLink(){if("undefined"!=typeof self&&"undefined"!=typeof document&&document.getElementById&&self.origin&&"null"!==self.origin&&self.navigator&&self.navigator.userAgent&&!self.navigator.userAgent.includes("Node.js")&&!self.navigator.userAgent.includes("jsdom")){if(!document.getElementById("scratch-link-extension-script")){const t=document.createElement("script");t.id="scratch-link-extension-script",document.body.appendChild(t),self.postMessage("inject-scratch-link-script",self.origin)}}}getScratchLinkSocket(t){return(this._linkSocketFactory||this._defaultScratchLinkSocketFactory)(t)}configureScratchLinkSocketFactory(t){this._linkSocketFactory=t}_defaultScratchLinkSocketFactory(t){const e=self.Scratch,n=e&&e.ScratchLinkSafariSocket;return n&&n.isSafariHelperCompatible()?new n(t):new I(t)}registerPeripheralExtension(t,e){this.peripheralExtensions[t]=e}scanForPeripheral(t){this.peripheralExtensions[t]&&this.peripheralExtensions[t].scan()}connectPeripheral(t,e){this.peripheralExtensions[t]&&this.peripheralExtensions[t].connect(e)}disconnectPeripheral(t){this.peripheralExtensions[t]&&this.peripheralExtensions[t].disconnect()}getPeripheralIsConnected(t){let e=!1;return this.peripheralExtensions[t]&&(e=this.peripheralExtensions[t].isConnected()),e}emitMicListening(t){this.emit(Q.MIC_LISTENING,t)}getOpcodeFunction(t){return this._primitives[t]}getIsHat(t){return Object.prototype.hasOwnProperty.call(this._hats,t)}getIsEdgeActivatedHat(t){return Object.prototype.hasOwnProperty.call(this._hats,t)&&this._hats[t].edgeActivated}attachAudioEngine(t){this.audioEngine=t}attachRenderer(t){this.renderer=t,this.renderer.setLayerGroupOrdering(E.LAYER_GROUPS),this.renderer.offscreenTouching=!this.runtimeOptions.fencing,this.updatePrivacy()}attachV2BitmapAdapter(t){this.v2BitmapAdapter=t}attachStorage(t){if(this.storage=t,this.isPackaged){const e=t.createAsset;let n=0;t.createAsset=function(t,r,i,s,o){return s||(s=(++n).toString()),e.call(this,t,r,i,s,!1)}}x.setFetch(t.scratchFetch.scratchFetch),this.resetRunId()}_pushThread(t,e,n){const r=new v(t);return r.target=e,r.stackClick=Boolean(n&&n.stackClick),r.updateMonitor=Boolean(n&&n.updateMonitor),r.blockContainer=r.updateMonitor?this.monitorBlocks:e.blocks,r.pushStack(t),this.threads.push(r),r.stackClick||r.updateMonitor||this.threadMap.set(r.getId(),r),n&&n.updateMonitor||!this.compilerOptions.enabled||r.tryCompile(),r}_stopThread(t){t.isKilled=!0,this.sequencer.retireThread(t)}_restartThread(t){const e=new v(t.topBlock);e.target=t.target,e.stackClick=t.stackClick,e.updateMonitor=t.updateMonitor,e.blockContainer=t.blockContainer,e.pushStack(t.topBlock),t.triedToCompile&&this.compilerOptions.enabled&&e.tryCompile(),e.stackClick||e.updateMonitor||this.threadMap.set(e.getId(),e);const n=this.threads.indexOf(t);return n>-1?(this.threads[n]=e,e):(this.threads.push(t),t)}emitCompileError(t,e){this.emit(Q.COMPILE_ERROR,t,e)}isActiveThread(t){return t.stack.length>0&&t.status!==v.STATUS_DONE&&this.threads.indexOf(t)>-1}isWaitingThread(t){return t.status===v.STATUS_PROMISE_WAIT||t.status===v.STATUS_YIELD_TICK||!this.isActiveThread(t)}toggleScript(t,e){e=Object.assign({target:this._editingTarget,stackClick:!1},e);for(let n=0;n<this.threads.length;n++)if(this.threads[n].topBlock===t&&this.threads[n].status!==v.STATUS_DONE){const r=e.target.blocks,i=r.getOpcode(r.getBlock(t));if(this.getIsEdgeActivatedHat(i)&&this.threads[n].stackClick!==e.stackClick)continue;return void this._stopThread(this.threads[n])}this._pushThread(t,e.target,e)}addMonitorScript(t,e){e||(e=this._editingTarget);for(let e=0;e<this.threads.length;e++)if(this.threads[e].topBlock===t&&this.threads[e].status!==v.STATUS_DONE&&this.threads[e].updateMonitor)return;this._pushThread(t,e,{updateMonitor:!0})}allScriptsDo(t,e){let n=this.executableTargets;e&&(n=[e]);for(let e=n.length-1;e>=0;e--){const r=n[e],i=r.blocks.getScripts();for(let e=0;e<i.length;e++){t(i[e],r)}}}allScriptsByOpcodeDo(t,e,n){let r=this.executableTargets;n&&(r=[n]);for(let n=r.length-1;n>=0;n--){const i=r[n],s=h.getScripts(i.blocks,t);for(let t=0;t<s.length;t++)e(s[t],i)}}startHats(t,e,n){if(!Object.prototype.hasOwnProperty.call(this._hats,t))return;const r=[],i=this._hats[t];for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(e[t]=e[t].toUpperCase());const s=this.threads.length;return this.allScriptsByOpcodeDo(t,((t,n)=>{const{blockId:o,fieldsOfInputs:a}=t;for(const t in e)if(a[t].value!==e[t])return;if(i.restartExistingThreads){const t=this.threadMap.get(v.getIdFromTargetAndBlock(n,o));if(t)return void r.push(this._restartThread(t))}else for(let t=0;t<s;t++)if(this.threads[t].target===n&&this.threads[t].topBlock===o&&!this.threads[t].stackClick&&this.threads[t].status!==v.STATUS_DONE)return;r.push(this._pushThread(o,n))}),n),r.forEach((t=>{t.isCompiled?t.executableHat&&(g.saveGlobalState(),g(t),g.restoreGlobalState()):(m(this.sequencer,t),t.goToNextBlock())})),r}dispose(){this.stopAll(),this.targets.forEach((t=>{t.isOriginal&&t.deleteMonitors()})),this.targets.map(this.disposeTarget,this),this.extensionStorage={};const t=o({});t.equals(this._monitorState)||(this._monitorState=t,this.emit(Q.MONITORS_UPDATE,this._monitorState)),this.emit(Q.RUNTIME_DISPOSED),this.ioDevices.clock.resetProjectTimer(),this.fontManager.clear(),this.hasCloudData()&&this.emit(Q.HAS_CLOUD_DATA_UPDATE,!1),this.ioDevices.cloud.clear();const e=H(this.cloudOptions);this.hasCloudData=e.hasCloudVariables,this.canAddCloudVariable=e.canAddCloudVariable,this.getNumberOfCloudVariables=e.getNumberOfCloudVariables,this.addCloudVariable=this._initializeAddCloudVariable(e),this.removeCloudVariable=this._initializeRemoveCloudVariable(e),this.resetProgress()}addTarget(t){this.targets.push(t),this.executableTargets.push(t),t.isStage&&!this._stageTarget&&(this._stageTarget=t)}moveExecutable(t,e){const n=this.executableTargets.indexOf(t);this.executableTargets.splice(n,1);let r=n+e;return r>this.executableTargets.length&&(r=this.executableTargets.length),r<=0&&(r=this.executableTargets.length>0&&this.executableTargets[0].isStage?1:0),this.executableTargets.splice(r,0,t),r}setExecutablePosition(t,e){const n=this.executableTargets.indexOf(t);return this.moveExecutable(t,e-n)}removeExecutable(t){const e=this.executableTargets.indexOf(t);e>-1&&this.executableTargets.splice(e,1)}disposeTarget(t){this.targets=this.targets.filter((e=>t!==e||(e.dispose(),!1))),this._stageTarget===t&&(this._stageTarget=null)}stopForTarget(t,e){this.emit(Q.STOP_FOR_TARGET,t,e);for(let n=0;n<this.threads.length;n++)this.threads[n]!==e&&this.threads[n].target===t&&this._stopThread(this.threads[n])}resetRunId(){if(!this.storage)return;const t=c.v1();this.storage.scratchFetch.setMetadata(this.storage.scratchFetch.RequestMetadata.RunId,t)}greenFlag(){this.stopAll(),this.emit(Q.PROJECT_START),this.updateCurrentMSecs(),this.ioDevices.clock.resetProjectTimer(),this.targets.forEach((t=>t.clearEdgeActivatedValues()));for(let t=0;t<this.targets.length;t++)this.targets[t].onGreenFlag();this.startHats("event_whenflagclicked")}stopAll(){this.emit(Q.PROJECT_STOP_ALL);const t=[];for(let e=0;e<this.targets.length;e++)this.targets[e].onStopAll(),Object.prototype.hasOwnProperty.call(this.targets[e],"isOriginal")&&!this.targets[e].isOriginal?this.targets[e].dispose():t.push(this.targets[e]);this.targets=t,null!==this.sequencer.activeThread&&this._stopThread(this.sequencer.activeThread),this.threads=[],this.threadMap.clear(),this.resetRunId()}_renderInterpolatedPositions(){const t=this._lastStepTime,e=Date.now()-t,n=Math.min(1,Math.max(0,e/this.currentStepTime));F.interpolate(this,n),this.renderer&&this.renderer.draw()}updateThreadMap(){this.threadMap.clear();for(const t of this.threads)t.stackClick||t.updateMonitor||this.threadMap.set(t.getId(),t)}_step(){this.interpolationEnabled&&F.setupInitialState(this),null!==this.profiler&&(-1===W&&(W=this.profiler.idByName("Runtime._step")),this.profiler.start(W)),this.threads=this.threads.filter((t=>!t.isKilled)),this.updateThreadMap();for(const t in this._hats){if(!Object.prototype.hasOwnProperty.call(this._hats,t))continue;this._hats[t].edgeActivated&&this.startHats(t)}this.redrawRequested=!1,this._pushMonitors(),null!==this.profiler&&(-1===K&&(K=this.profiler.idByName("Sequencer.stepThreads")),this.profiler.start(K)),this.emit(Q.BEFORE_EXECUTE);const t=this.sequencer.stepThreads();null!==this.profiler&&this.profiler.stop(),this.emit(Q.AFTER_EXECUTE),this._updateGlows(t),this._emitProjectRunStatus(this.threads.length+t.length-this._getMonitorThreadCount([...this.threads,...t])),this._lastStepDoneThreads=t,this.renderer&&(null!==this.profiler&&(-1===q&&(q=this.profiler.idByName("RenderWebGL.draw")),this.profiler.start(q)),document.hidden||this.frameLoop._interpolationAnimation||this.renderer.draw(),null!==this.profiler&&this.profiler.stop()),this._refreshTargets&&(this.emit(Q.TARGETS_UPDATE,!1),this._refreshTargets=!1),this._prevMonitorState.equals(this._monitorState)||(this.emit(Q.MONITORS_UPDATE,this._monitorState),this._prevMonitorState=this._monitorState),null!==this.profiler&&(this.profiler.stop(),this.profiler.reportFrames()),this.interpolationEnabled&&(this._lastStepTime=Date.now())}_getMonitorThreadCount(t){let e=0;return t.forEach((t=>{t.updateMonitor&&e++})),e}_pushMonitors(){this.monitorBlocks.runAllMonitored(this)}setEditingTarget(t){const e=this._editingTarget;this._editingTarget=t,this._scriptGlowsPreviousFrame=[],this._updateGlows(),e!==this._editingTarget&&this.requestToolboxExtensionsUpdate()}setCompatibilityMode(t){t?this.setFramerate(30):this.setFramerate(60)}setFramerate(t){t>250&&(t=250),t<0&&(t=1),this.frameLoop.setFramerate(t),this.emit(Q.FRAMERATE_CHANGED,t)}setInterpolation(t){this.interpolationEnabled=t,this.frameLoop.setInterpolation(this.interpolationEnabled),this.emit(Q.INTERPOLATION_CHANGED,t)}setRuntimeOptions(t){this.runtimeOptions=Object.assign({},this.runtimeOptions,t),this.emit(Q.RUNTIME_OPTIONS_CHANGED,this.runtimeOptions),this.renderer&&(this.renderer.offscreenTouching=!this.runtimeOptions.fencing)}setCompilerOptions(t){this.compilerOptions=Object.assign({},this.compilerOptions,t),this.resetAllCaches(),this.emit(Q.COMPILER_OPTIONS_CHANGED,this.compilerOptions)}setStageSize(t,e){if(t=Math.round(Math.max(1,t)),e=Math.round(Math.max(1,e)),this.stageWidth!==t||this.stageHeight!==e){const n=t-this.stageWidth,r=e-this.stageHeight;if(this._monitorState.size>0){const t=n/2,e=r/2;for(const n of this._monitorState.valueSeq()){const r=n.set("x",n.get("x")+t).set("y",n.get("y")+e);this.requestUpdateMonitor(r)}this.emit(Q.MONITORS_UPDATE,this._monitorState)}this.stageWidth=t,this.stageHeight=e,this.renderer&&this.renderer.setStageSize(-t/2,t/2,-e/2,e/2),this.emit(Q.STAGE_SIZE_CHANGED,t,e)}}setInEditor(t){}convertToPackagedRuntime(){if(this.storage)throw new Error("convertToPackagedRuntime must be called before attachStorage");this.isPackaged=!0}resetAllCaches(){for(const t of this.targets)t.isOriginal&&t.blocks.resetCache();this.flyoutBlocks.resetCache(),this.monitorBlocks.resetCache()}addAddonBlock(t){const e=t.procedureCode,n=t.arguments||[],s=n,o=n.map(((t,e)=>"arg".concat(e))),a=n.map((()=>""));if(this.addonBlocks[e]=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({namesIdsDefaults:[s,o,a]},t),!t.hidden){const n="a-b";let r=this._blockInfo.find((t=>t.id===n));if(!r){const t='<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48"><path d="M14.92 1.053A13.835 13.835 0 0 0 1.052 14.919v18.162a13.835 13.835 0 0 0 13.866 13.866h18.162a13.835 13.835 0 0 0 13.866-13.866V14.919A13.835 13.835 0 0 0 33.081 1.053zm16.6 12.746L41.72 24 31.52 34.201l-3.276-3.275L35.17 24l-6.926-6.926Zm-15.116.073 3.278 3.278L12.83 24l6.926 6.926L16.48 34.2 6.28 24Z" style="fill:#29beb8;fill-opacity:1;stroke:none;stroke-width:1.51371;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/></svg>';r={id:n,name:T({id:"tw.blocks.addons",default:"Addons",description:"Name of the addon block category in the extension list"}),color1:"#29beb8",color2:"#3aa8a4",color3:"#3aa8a4",menuIconURI:"data:image/svg+xml;,".concat(encodeURIComponent(t)),blocks:[],customFieldTypes:{},menus:[]},this._blockInfo.unshift(r)}r.blocks.push({info:{},xml:'<block type="procedures_call" gap="16"><mutation generateshadows="true" warp="false"'+' proccode="'.concat(k(e),'"')+' argumentnames="'.concat(k(JSON.stringify(s)),'"')+' argumentids="'.concat(k(JSON.stringify(o)),'"')+' argumentdefaults="'.concat(k(JSON.stringify(a)),'"')+"".concat(t.return?' return="'.concat(k(t.return.toString()),'"'):"")+"></mutation></block>"})}this.resetAllCaches()}getAddonBlock(t){return Object.prototype.hasOwnProperty.call(this.addonBlocks,t)?this.addonBlocks[t]:null}findProjectOptionsComment(){const t=this.getTargetForStage().comments;for(const e of Object.values(t))if(e.text.includes(G))return e;return null}parseProjectOptions(){const t=this.findProjectOptionsComment();if(!t)return;const e=t.text.split("\n").find((t=>t.endsWith(G)));if(!e)return void w.warn("Config comment does not contain valid line");const n=e.substr(0,e.length-14);let r;try{if(r=a.parse(n),!r||"object"!=typeof r)throw new Error("Invalid object")}catch(t){return void w.warn("Config comment has invalid JSON",t)}"number"==typeof r.framerate&&this.setFramerate(r.framerate),r.turbo&&(this.turboMode=!0,this.emit(Q.TURBO_MODE_ON)),r.interpolation&&this.setInterpolation(!0),r.runtimeOptions&&this.setRuntimeOptions(r.runtimeOptions),r.hq&&this.renderer&&this.renderer.setUseHighQualityRender(!0);const i=+r.width||this.stageWidth,s=+r.height||this.stageHeight;i===this.stageWidth&&s===this.stageHeight||this.setStageSize(i,s)}_generateAllProjectOptions(){return{framerate:this.frameLoop.framerate,runtimeOptions:this.runtimeOptions,interpolation:this.interpolationEnabled,turbo:this.turboMode,hq:!!this.renderer&&this.renderer.useHighQualityRender,width:this.stageWidth,height:this.stageHeight}}generateDifferingProjectOptions(){const t=(e,n)=>{const r={};for(const i of Object.keys(n)){const s=n[i],o=e[i];if("object"==typeof s&&s){const e=t(o,s);Object.keys(e).length>0&&(r[i]=e)}else s!==o&&(r[i]=s)}return r};return t(this._defaultStoredSettings,this._generateAllProjectOptions())}storeProjectOptions(){const t=this.generateDifferingProjectOptions(),e="Configuration for https://turbowarp.org/\nYou can move, resize, and minimize this comment, but don't edit it by hand. This comment can be deleted to remove the stored settings.\n".concat(a.stringify(t)).concat(G),n=this.findProjectOptionsComment();if(n)n.text=e;else{this.getTargetForStage().createComment(U(),null,e,50,50,350,170,!1)}this.emitProjectChanged()}precompile(){this.allScriptsDo(((t,e)=>{const n=e.blocks.getBlock(t);if(this.getIsHat(n.opcode)){const n=new v(t);n.target=e,n.blockContainer=e.blocks,n.tryCompile()}}))}enableDebug(){this.resetAllCaches(),this.debug=!0}_updateGlows(t){const e=[];e.push(...this.threads),t&&e.push(...t);const n=[],r=[];for(let t=0;t<e.length;t++){const r=e[t],i=r.target;if(i===this._editingTarget){const t=r.blockGlowInFrame;if(r.requestScriptGlowInFrame||r.stackClick){let e=i.blocks.getTopLevelScript(t);e||(e=this.flyoutBlocks.getTopLevelScript(t)),e&&n.push(e)}}}for(let t=0;t<this._scriptGlowsPreviousFrame.length;t++){const e=this._scriptGlowsPreviousFrame[t];n.indexOf(e)<0?this.glowScript(e,!1):r.push(e)}for(let t=0;t<n.length;t++){const e=n[t];this._scriptGlowsPreviousFrame.indexOf(e)<0&&(this.glowScript(e,!0),r.push(e))}this._scriptGlowsPreviousFrame=r}_emitProjectRunStatus(t){0===this._nonMonitorThreadCount&&t>0&&this.emit(Q.PROJECT_RUN_START),this._nonMonitorThreadCount>0&&0===t&&this.emit(Q.PROJECT_RUN_STOP),this._nonMonitorThreadCount=t}quietGlow(t){const e=this._scriptGlowsPreviousFrame.indexOf(t);e>-1&&this._scriptGlowsPreviousFrame.splice(e,1)}glowBlock(t,e){e?this.emit(Q.BLOCK_GLOW_ON,{id:t}):this.emit(Q.BLOCK_GLOW_OFF,{id:t})}glowScript(t,e){e?this.emit(Q.SCRIPT_GLOW_ON,{id:t}):this.emit(Q.SCRIPT_GLOW_OFF,{id:t})}emitBlockDragUpdate(t){this.emit(Q.BLOCK_DRAG_UPDATE,t)}emitBlockEndDrag(t,e){this.emit(Q.BLOCK_DRAG_END,t,e)}visualReport(t,e,n){t===this.getEditingTarget()&&this.emit(Q.VISUAL_REPORT,{id:e,value:String(n)})}requestAddMonitor(t){const e=t.get("id");this.requestUpdateMonitor(t)||(this._monitorState=this._monitorState.set(e,t))}requestUpdateMonitor(t){const e=t.get("id");return!!this._monitorState.has(e)&&(this._monitorState=this._monitorState.set(e,this._monitorState.get(e).mergeWith(((t,e)=>null==e?t:e),t)),!0)}requestRemoveMonitor(t){this._monitorState=this._monitorState.delete(t)}requestHideMonitor(t){return this.requestUpdateMonitor(new Map([["id",t],["visible",!1]]))}requestShowMonitor(t){return this.requestUpdateMonitor(new Map([["id",t],["visible",!0]]))}requestRemoveMonitorByTargetId(t){this._monitorState=this._monitorState.filterNot((e=>e.targetId===t))}getTargetById(t){for(let e=0;e<this.targets.length;e++){const n=this.targets[e];if(n.id===t)return n}}getSpriteTargetByName(t){for(let e=0;e<this.targets.length;e++){const n=this.targets[e];if(!n.isStage&&(n.sprite&&n.sprite.name===t))return n}}getTargetByDrawableId(t){for(let e=0;e<this.targets.length;e++){const n=this.targets[e];if(n.drawableID===t)return n}}changeCloneCounter(t){this._cloneCounter+=t}clonesAvailable(){return this._cloneCounter<this.runtimeOptions.maxClones}handleProjectLoaded(){this.emit(Q.PROJECT_LOADED),this.resetRunId()}emitProjectChanged(){this.emit(Q.PROJECT_CHANGED)}fireTargetWasCreated(t,e){this.emit("targetWasCreated",t,e)}fireTargetWasRemoved(t){this.emit("targetWasRemoved",t)}getTargetForStage(){if(this._stageTarget)return this._stageTarget;for(let t=0;t<this.targets.length;t++){const e=this.targets[t];if(e.isStage)return this._stageTarget=e,e}}getEditingTarget(){return this._editingTarget}getAllVarNamesOfType(t){let e=[];for(const n of this.targets){const r=n.getAllVariableNamesInScopeByType(t,!0);e=e.concat(r)}return e}getLabelForOpcode(t){const[e,n]=B.splitFirst(t,"_");if(!e||!n)return;const r=this._blockInfo.find((t=>t.id===e));if(!r)return;const i=r.blocks.find((t=>t.info.opcode===n));return i?{category:"extension",label:"".concat(r.name,": ").concat(i.info.text)}:void 0}createNewGlobalVariable(t,e,n){const r="string"==typeof n?n:A.SCALAR_TYPE,i=this.getAllVarNamesOfType(r),s=B.unusedName(t,i),o=new A(e||U(),s,r);return this.getTargetForStage().variables[o.id]=o,o}requestRedraw(){this.redrawRequested=!0}requestTargetsUpdate(t){t.isOriginal&&(this._refreshTargets=!0)}requestBlocksUpdate(){this.emit(Q.BLOCKS_NEED_UPDATE)}requestToolboxExtensionsUpdate(){this.emit(Q.TOOLBOX_EXTENSIONS_NEED_UPDATE)}start(){this.frameLoop.running||(this.frameLoop.start(),this.emit(Q.RUNTIME_STARTED))}stop(){this.quit()}quit(){this.frameLoop.running&&(this.frameLoop.stop(),this.emit(Q.RUNTIME_STOPPED))}enableProfiling(t){p.available()&&(this.profiler=new p(t))}disableProfiling(){this.profiler=null}updateCurrentMSecs(){this.currentMSecs=Date.now()}updatePrivacy(){const t=this.enforcePrivacy&&Object.values(this.externalCommunicationMethods).some((t=>t));this.renderer&&this.renderer.setPrivateSkinAccess&&this.renderer.setPrivateSkinAccess(!t)}setEnforcePrivacy(t){this.enforcePrivacy=t,this.updatePrivacy()}setExternalCommunicationMethod(t,e){if(!Object.prototype.hasOwnProperty.call(this.externalCommunicationMethods,t))throw new Error("Unknown method: ".concat(t));this.externalCommunicationMethods[t]=e,this.updatePrivacy()}emitAssetProgress(){this.emit(Q.ASSET_PROGRESS,this.finishedAssetRequests,this.totalAssetRequests)}resetProgress(){this.finishedAssetRequests=0,this.totalAssetRequests=0,this.emitAssetProgress()}wrapAssetRequest(t){this.totalAssetRequests++,this.emitAssetProgress();return t().then((t=>(this.finishedAssetRequests++,this.emitAssetProgress(),t)),(t=>{throw this.finishedAssetRequests++,this.emitAssetProgress(),t}))}}t.exports=Q},function(t,e,n){const{Record:r}=n(21),i=r({id:null,spriteName:null,targetId:null,opcode:null,value:null,params:null,mode:"default",sliderMin:0,sliderMax:100,isDiscrete:!0,x:null,y:null,width:0,height:0,visible:!0});t.exports=i},function(t,e){t.exports=function(t,e){let n="";for(const t in e){let r=e[t].value;"CURRENTMENU"===t&&(r=r.toLowerCase()),n+="_".concat(r)}return"".concat(t).concat(n)}},function(t,e,n){const r=n(1),i=n(6),s=n(2),o=n(9),a=n(0),{IntermediateScript:c,IntermediateRepresentation:u}=n(65),l=n(187),h="",d="list",p=t=>t.substring(1);class f{constructor(t){this.thread=t,this.target=t.target,this.blocks=t.blockContainer,this.runtime=this.target.runtime,this.stage=this.runtime.getTargetForStage(),this.script=new c,this.script.warpTimer=this.target.runtime.compilerOptions.warpTimer,this.variableCache={},this.usesTimer=!1}setProcedureVariant(t){const e=p(t);this.script.procedureVariant=t,this.script.procedureCode=e,this.script.isProcedure=!0,this.script.yields=!1;const n=this.blocks.getProcedureParamNamesIdsAndDefaults(e);if(null===n)throw new Error("IR: cannot find procedure: ".concat(t));const[r,i,s]=n;this.script.arguments=r}enableWarp(){this.script.isWarp=!0}getBlockById(t){return this.blocks.getBlock(t)||this.blocks.runtime.flyoutBlocks.getBlock(t)}getBlockInfo(t){const[e,n]=i.splitFirst(t,"_");if(!e||!n)return null;const r=this.runtime._blockInfo.find((t=>t.id===e));if(!r)return null;const s=r.blocks.find((t=>t.info.opcode===n));return s||null}descendInputOfBlock(t,e){const n=t.inputs[e];if(!n)return a.warn("IR: ".concat(t.opcode,": missing input ").concat(e),t),{kind:"constant",value:0};const r=n.block,i=this.getBlockById(r);return i?this.descendInput(i):(a.warn("IR: ".concat(t.opcode,": could not find input ").concat(e," with ID ").concat(r)),{kind:"constant",value:0})}descendInput(t){switch(t.opcode){case"colour_picker":return{kind:"constant",value:t.fields.COLOUR.value};case"math_angle":case"math_integer":case"math_number":case"math_positive_number":case"math_whole_number":return{kind:"constant",value:t.fields.NUM.value};case"text":return{kind:"constant",value:t.fields.TEXT.value};case"argument_reporter_string_number":{const e=t.fields.VALUE.value,n=this.script.arguments.lastIndexOf(e);return-1===n&&"last key pressed"===e.toLowerCase()?{kind:"tw.lastKeyPressed"}:-1===n?{kind:"constant",value:0}:{kind:"procedures.argument",index:n}}case"argument_reporter_boolean":{const e=t.fields.VALUE.value,n=this.script.arguments.lastIndexOf(e);return-1===n?"is compiled?"===e.toLowerCase()||"is turbowarp?"===e.toLowerCase()?{kind:"constant",value:!0}:{kind:"constant",value:0}:{kind:"procedures.argument",index:n}}case"control_get_counter":return{kind:"counter.get"};case"data_variable":return{kind:"var.get",variable:this.descendVariable(t,"VARIABLE",h)};case"data_itemoflist":return{kind:"list.get",list:this.descendVariable(t,"LIST",d),index:this.descendInputOfBlock(t,"INDEX")};case"data_lengthoflist":return{kind:"list.length",list:this.descendVariable(t,"LIST",d)};case"data_listcontainsitem":return{kind:"list.contains",list:this.descendVariable(t,"LIST",d),item:this.descendInputOfBlock(t,"ITEM")};case"data_itemnumoflist":return{kind:"list.indexOf",list:this.descendVariable(t,"LIST",d),item:this.descendInputOfBlock(t,"ITEM")};case"data_listcontents":return{kind:"list.contents",list:this.descendVariable(t,"LIST",d)};case"event_broadcast_menu":{const e=t.fields.BROADCAST_OPTION,n=this.target.lookupBroadcastMsg(e.id,e.value);return{kind:"constant",value:n?n.name:""}}case"looks_backdropnumbername":return"number"===t.fields.NUMBER_NAME.value?{kind:"looks.backdropNumber"}:{kind:"looks.backdropName"};case"looks_costumenumbername":return"number"===t.fields.NUMBER_NAME.value?{kind:"looks.costumeNumber"}:{kind:"looks.costumeName"};case"looks_size":return{kind:"looks.size"};case"motion_direction":return{kind:"motion.direction"};case"motion_xposition":return{kind:"motion.x"};case"motion_yposition":return{kind:"motion.y"};case"operator_add":return{kind:"op.add",left:this.descendInputOfBlock(t,"NUM1"),right:this.descendInputOfBlock(t,"NUM2")};case"operator_and":return{kind:"op.and",left:this.descendInputOfBlock(t,"OPERAND1"),right:this.descendInputOfBlock(t,"OPERAND2")};case"operator_contains":return{kind:"op.contains",string:this.descendInputOfBlock(t,"STRING1"),contains:this.descendInputOfBlock(t,"STRING2")};case"operator_divide":return{kind:"op.divide",left:this.descendInputOfBlock(t,"NUM1"),right:this.descendInputOfBlock(t,"NUM2")};case"operator_equals":return{kind:"op.equals",left:this.descendInputOfBlock(t,"OPERAND1"),right:this.descendInputOfBlock(t,"OPERAND2")};case"operator_gt":return{kind:"op.greater",left:this.descendInputOfBlock(t,"OPERAND1"),right:this.descendInputOfBlock(t,"OPERAND2")};case"operator_join":return{kind:"op.join",left:this.descendInputOfBlock(t,"STRING1"),right:this.descendInputOfBlock(t,"STRING2")};case"operator_length":return{kind:"op.length",string:this.descendInputOfBlock(t,"STRING")};case"operator_letter_of":return{kind:"op.letterOf",letter:this.descendInputOfBlock(t,"LETTER"),string:this.descendInputOfBlock(t,"STRING")};case"operator_lt":return{kind:"op.less",left:this.descendInputOfBlock(t,"OPERAND1"),right:this.descendInputOfBlock(t,"OPERAND2")};case"operator_mathop":{const e=this.descendInputOfBlock(t,"NUM");switch(t.fields.OPERATOR.value.toLowerCase()){case"abs":return{kind:"op.abs",value:e};case"floor":return{kind:"op.floor",value:e};case"ceiling":return{kind:"op.ceiling",value:e};case"sqrt":return{kind:"op.sqrt",value:e};case"sin":return{kind:"op.sin",value:e};case"cos":return{kind:"op.cos",value:e};case"tan":return{kind:"op.tan",value:e};case"asin":return{kind:"op.asin",value:e};case"acos":return{kind:"op.acos",value:e};case"atan":return{kind:"op.atan",value:e};case"ln":return{kind:"op.ln",value:e};case"log":return{kind:"op.log",value:e};case"e ^":return{kind:"op.e^",value:e};case"10 ^":return{kind:"op.10^",value:e};default:return{kind:"constant",value:0}}}case"operator_mod":return{kind:"op.mod",left:this.descendInputOfBlock(t,"NUM1"),right:this.descendInputOfBlock(t,"NUM2")};case"operator_multiply":return{kind:"op.multiply",left:this.descendInputOfBlock(t,"NUM1"),right:this.descendInputOfBlock(t,"NUM2")};case"operator_not":return{kind:"op.not",operand:this.descendInputOfBlock(t,"OPERAND")};case"operator_or":return{kind:"op.or",left:this.descendInputOfBlock(t,"OPERAND1"),right:this.descendInputOfBlock(t,"OPERAND2")};case"operator_random":{const e=this.descendInputOfBlock(t,"FROM"),n=this.descendInputOfBlock(t,"TO");if("constant"===e.kind&&"constant"===n.kind){const t=e.value,i=n.value,s=r.toNumber(t),o=r.toNumber(i);return s===o?{kind:"constant",value:s}:r.isInt(t)&&r.isInt(i)?{kind:"op.random",low:s<=o?e:n,high:s<=o?n:e,useInts:!0,useFloats:!1}:{kind:"op.random",low:s<=o?e:n,high:s<=o?n:e,useInts:!1,useFloats:!0}}if("constant"===e.kind){if(!r.isInt(r.toNumber(e.value)))return{kind:"op.random",low:e,high:n,useInts:!1,useFloats:!0}}else if("constant"===n.kind&&!r.isInt(r.toNumber(n.value)))return{kind:"op.random",low:e,high:n,useInts:!1,useFloats:!0};return{kind:"op.random",low:e,high:n,useInts:!1,useFloats:!1}}case"operator_round":return{kind:"op.round",value:this.descendInputOfBlock(t,"NUM")};case"operator_subtract":return{kind:"op.subtract",left:this.descendInputOfBlock(t,"NUM1"),right:this.descendInputOfBlock(t,"NUM2")};case"procedures_call":return this.descendProcedure(t);case"sensing_answer":return{kind:"sensing.answer"};case"sensing_coloristouchingcolor":return{kind:"sensing.colorTouchingColor",target:this.descendInputOfBlock(t,"COLOR2"),mask:this.descendInputOfBlock(t,"COLOR")};case"sensing_current":switch(t.fields.CURRENTMENU.value.toLowerCase()){case"year":return{kind:"sensing.year"};case"month":return{kind:"sensing.month"};case"date":return{kind:"sensing.date"};case"dayofweek":return{kind:"sensing.dayofweek"};case"hour":return{kind:"sensing.hour"};case"minute":return{kind:"sensing.minute"};case"second":return{kind:"sensing.second"}}return{kind:"constant",value:0};case"sensing_dayssince2000":return{kind:"sensing.daysSince2000"};case"sensing_distanceto":return{kind:"sensing.distance",target:this.descendInputOfBlock(t,"DISTANCETOMENU")};case"sensing_keypressed":return{kind:"keyboard.pressed",key:this.descendInputOfBlock(t,"KEY_OPTION")};case"sensing_mousedown":return{kind:"mouse.down"};case"sensing_mousex":return{kind:"mouse.x"};case"sensing_mousey":return{kind:"mouse.y"};case"sensing_of":return{kind:"sensing.of",property:t.fields.PROPERTY.value,object:this.descendInputOfBlock(t,"OBJECT")};case"sensing_timer":return this.usesTimer=!0,{kind:"timer.get"};case"sensing_touchingcolor":return{kind:"sensing.touchingColor",color:this.descendInputOfBlock(t,"COLOR")};case"sensing_touchingobject":return{kind:"sensing.touching",object:this.descendInputOfBlock(t,"TOUCHINGOBJECTMENU")};case"sensing_username":return{kind:"sensing.username"};case"sound_sounds_menu":return{kind:"constant",value:t.fields.SOUND_MENU.value};case"tw_getLastKeyPressed":return{kind:"tw.lastKeyPressed"};default:{if(this.runtime.getOpcodeFunction(t.opcode)){if(l.inputs.includes(t.opcode))return this.descendCompatLayer(t);const e=this.getBlockInfo(t.opcode);if(e){const n=e.info.blockType;if(n===s.REPORTER||n===s.BOOLEAN)return this.descendCompatLayer(t)}}const e=Object.keys(t.inputs),n=Object.keys(t.fields);if(0===e.length&&1===n.length)return{kind:"constant",value:t.fields[n[0]].value};throw a.warn("IR: Unknown input: ".concat(t.opcode),t),new Error("IR: Unknown input: ".concat(t.opcode))}}}descendStackedBlock(t){switch(t.opcode){case"control_all_at_once":return{kind:"control.if",condition:{kind:"constant",value:!0},whenTrue:this.descendSubstack(t,"SUBSTACK"),whenFalse:[]};case"control_clear_counter":return{kind:"counter.clear"};case"control_create_clone_of":return{kind:"control.createClone",target:this.descendInputOfBlock(t,"CLONE_OPTION")};case"control_delete_this_clone":return this.script.yields=!0,{kind:"control.deleteClone"};case"control_forever":return this.analyzeLoop(),{kind:"control.while",condition:{kind:"constant",value:!0},do:this.descendSubstack(t,"SUBSTACK")};case"control_for_each":return this.analyzeLoop(),{kind:"control.for",variable:this.descendVariable(t,"VARIABLE",h),count:this.descendInputOfBlock(t,"VALUE"),do:this.descendSubstack(t,"SUBSTACK")};case"control_if":return{kind:"control.if",condition:this.descendInputOfBlock(t,"CONDITION"),whenTrue:this.descendSubstack(t,"SUBSTACK"),whenFalse:[]};case"control_if_else":return{kind:"control.if",condition:this.descendInputOfBlock(t,"CONDITION"),whenTrue:this.descendSubstack(t,"SUBSTACK"),whenFalse:this.descendSubstack(t,"SUBSTACK2")};case"control_incr_counter":return{kind:"counter.increment"};case"control_repeat":return this.analyzeLoop(),{kind:"control.repeat",times:this.descendInputOfBlock(t,"TIMES"),do:this.descendSubstack(t,"SUBSTACK")};case"control_repeat_until":{this.analyzeLoop(),this.usesTimer=!1;const e=this.descendInputOfBlock(t,"CONDITION"),n=this.usesTimer;return n&&(this.script.yields=!0),{kind:"control.while",condition:{kind:"op.not",operand:e},do:this.descendSubstack(t,"SUBSTACK"),warpTimer:n}}case"control_stop":{const e=t.fields.STOP_OPTION.value;return"all"===e?(this.script.yields=!0,{kind:"control.stopAll"}):"other scripts in sprite"===e||"other scripts in stage"===e?{kind:"control.stopOthers"}:"this script"===e?{kind:"control.stopScript"}:{kind:"noop"}}case"control_wait":return this.script.yields=!0,{kind:"control.wait",seconds:this.descendInputOfBlock(t,"DURATION")};case"control_wait_until":return this.script.yields=!0,{kind:"control.waitUntil",condition:this.descendInputOfBlock(t,"CONDITION")};case"control_while":return this.analyzeLoop(),{kind:"control.while",condition:this.descendInputOfBlock(t,"CONDITION"),do:this.descendSubstack(t,"SUBSTACK"),warpTimer:!1};case"data_addtolist":return{kind:"list.add",list:this.descendVariable(t,"LIST",d),item:this.descendInputOfBlock(t,"ITEM")};case"data_changevariableby":{const e=this.descendVariable(t,"VARIABLE",h);return{kind:"var.set",variable:e,value:{kind:"op.add",left:{kind:"var.get",variable:e},right:this.descendInputOfBlock(t,"VALUE")}}}case"data_deletealloflist":return{kind:"list.deleteAll",list:this.descendVariable(t,"LIST",d)};case"data_deleteoflist":{const e=this.descendInputOfBlock(t,"INDEX");return"constant"===e.kind&&"all"===e.value?{kind:"list.deleteAll",list:this.descendVariable(t,"LIST",d)}:{kind:"list.delete",list:this.descendVariable(t,"LIST",d),index:e}}case"data_hidelist":return{kind:"list.hide",list:this.descendVariable(t,"LIST",d)};case"data_hidevariable":return{kind:"var.hide",variable:this.descendVariable(t,"VARIABLE",h)};case"data_insertatlist":return{kind:"list.insert",list:this.descendVariable(t,"LIST",d),index:this.descendInputOfBlock(t,"INDEX"),item:this.descendInputOfBlock(t,"ITEM")};case"data_replaceitemoflist":return{kind:"list.replace",list:this.descendVariable(t,"LIST",d),index:this.descendInputOfBlock(t,"INDEX"),item:this.descendInputOfBlock(t,"ITEM")};case"data_setvariableto":return{kind:"var.set",variable:this.descendVariable(t,"VARIABLE",h),value:this.descendInputOfBlock(t,"VALUE")};case"data_showlist":return{kind:"list.show",list:this.descendVariable(t,"LIST",d)};case"data_showvariable":return{kind:"var.show",variable:this.descendVariable(t,"VARIABLE",h)};case"event_broadcast":return{kind:"event.broadcast",broadcast:this.descendInputOfBlock(t,"BROADCAST_INPUT")};case"event_broadcastandwait":return this.script.yields=!0,{kind:"event.broadcastAndWait",broadcast:this.descendInputOfBlock(t,"BROADCAST_INPUT")};case"looks_changeeffectby":return{kind:"looks.changeEffect",effect:t.fields.EFFECT.value.toLowerCase(),value:this.descendInputOfBlock(t,"CHANGE")};case"looks_changesizeby":return{kind:"looks.changeSize",size:this.descendInputOfBlock(t,"CHANGE")};case"looks_cleargraphiceffects":return{kind:"looks.clearEffects"};case"looks_goforwardbackwardlayers":return"forward"===t.fields.FORWARD_BACKWARD.value?{kind:"looks.forwardLayers",layers:this.descendInputOfBlock(t,"NUM")}:{kind:"looks.backwardLayers",layers:this.descendInputOfBlock(t,"NUM")};case"looks_gotofrontback":return"front"===t.fields.FRONT_BACK.value?{kind:"looks.goToFront"}:{kind:"looks.goToBack"};case"looks_hide":return{kind:"looks.hide"};case"looks_nextbackdrop":return{kind:"looks.nextBackdrop"};case"looks_nextcostume":return{kind:"looks.nextCostume"};case"looks_seteffectto":return{kind:"looks.setEffect",effect:t.fields.EFFECT.value.toLowerCase(),value:this.descendInputOfBlock(t,"VALUE")};case"looks_setsizeto":return{kind:"looks.setSize",size:this.descendInputOfBlock(t,"SIZE")};case"looks_show":return{kind:"looks.show"};case"looks_switchbackdropto":return{kind:"looks.switchBackdrop",backdrop:this.descendInputOfBlock(t,"BACKDROP")};case"looks_switchcostumeto":return{kind:"looks.switchCostume",costume:this.descendInputOfBlock(t,"COSTUME")};case"motion_changexby":return{kind:"motion.changeX",dx:this.descendInputOfBlock(t,"DX")};case"motion_changeyby":return{kind:"motion.changeY",dy:this.descendInputOfBlock(t,"DY")};case"motion_gotoxy":return{kind:"motion.setXY",x:this.descendInputOfBlock(t,"X"),y:this.descendInputOfBlock(t,"Y")};case"motion_ifonedgebounce":return{kind:"motion.ifOnEdgeBounce"};case"motion_movesteps":return{kind:"motion.step",steps:this.descendInputOfBlock(t,"STEPS")};case"motion_pointindirection":return{kind:"motion.setDirection",direction:this.descendInputOfBlock(t,"DIRECTION")};case"motion_setrotationstyle":return{kind:"motion.setRotationStyle",style:t.fields.STYLE.value};case"motion_setx":return{kind:"motion.setX",x:this.descendInputOfBlock(t,"X")};case"motion_sety":return{kind:"motion.setY",y:this.descendInputOfBlock(t,"Y")};case"motion_turnleft":return{kind:"motion.setDirection",direction:{kind:"op.subtract",left:{kind:"motion.direction"},right:this.descendInputOfBlock(t,"DEGREES")}};case"motion_turnright":return{kind:"motion.setDirection",direction:{kind:"op.add",left:{kind:"motion.direction"},right:this.descendInputOfBlock(t,"DEGREES")}};case"pen_clear":return{kind:"pen.clear"};case"pen_changePenColorParamBy":return{kind:"pen.changeParam",param:this.descendInputOfBlock(t,"COLOR_PARAM"),value:this.descendInputOfBlock(t,"VALUE")};case"pen_changePenHueBy":return{kind:"pen.legacyChangeHue",hue:this.descendInputOfBlock(t,"HUE")};case"pen_changePenShadeBy":return{kind:"pen.legacyChangeShade",shade:this.descendInputOfBlock(t,"SHADE")};case"pen_penDown":return{kind:"pen.down"};case"pen_penUp":return{kind:"pen.up"};case"pen_setPenColorParamTo":return{kind:"pen.setParam",param:this.descendInputOfBlock(t,"COLOR_PARAM"),value:this.descendInputOfBlock(t,"VALUE")};case"pen_setPenColorToColor":return{kind:"pen.setColor",color:this.descendInputOfBlock(t,"COLOR")};case"pen_setPenHueToNumber":return{kind:"pen.legacySetHue",hue:this.descendInputOfBlock(t,"HUE")};case"pen_setPenShadeToNumber":return{kind:"pen.legacySetShade",shade:this.descendInputOfBlock(t,"SHADE")};case"pen_setPenSizeTo":return{kind:"pen.setSize",size:this.descendInputOfBlock(t,"SIZE")};case"pen_changePenSizeBy":return{kind:"pen.changeSize",size:this.descendInputOfBlock(t,"SIZE")};case"pen_stamp":return{kind:"pen.stamp"};case"procedures_call":{const e=t.mutation.proccode;if(t.mutation.return){const e=this.descendVisualReport(t);if(e)return e}return"tw:debugger;"===e?{kind:"tw.debugger"}:this.descendProcedure(t)}case"procedures_return":return{kind:"procedures.return",value:this.descendInputOfBlock(t,"VALUE")};case"sensing_resettimer":return{kind:"timer.reset"};default:{if(this.runtime.getOpcodeFunction(t.opcode)){if(l.stacked.includes(t.opcode))return this.descendCompatLayer(t);const e=this.getBlockInfo(t.opcode);if(e){const n=e.info.blockType;if(n===s.COMMAND||n===s.CONDITIONAL||n===s.LOOP)return this.descendCompatLayer(t)}}const e=this.descendVisualReport(t);if(e)return e;throw a.warn("IR: Unknown stacked block: ".concat(t.opcode),t),new Error("IR: Unknown stacked block: ".concat(t.opcode))}}}descendSubstack(t,e){const n=t.inputs[e];if(!n)return[];const r=n.block;return this.walkStack(r)}walkStack(t){const e=[];let n=t;for(;null!==n;){const t=this.getBlockById(n);if(!t)break;const r=this.descendStackedBlock(t);e.push(r),n=t.next}return e}descendVariable(t,e,n){const r=t.fields[e],i=r.id;if(i&&Object.prototype.hasOwnProperty.call(this.variableCache,i))return this.variableCache[i];const s=this._descendVariable(i,r.value,n);return this.variableCache[s.id]=s,s}_descendVariable(t,e,n){const r=this.target,i=this.stage;if(Object.prototype.hasOwnProperty.call(r.variables,t)){const e=r.variables[t];return{scope:"target",id:e.id,name:e.name,isCloud:e.isCloud}}if(!r.isStage&&i&&Object.prototype.hasOwnProperty.call(i.variables,t)){const e=i.variables[t];return{scope:"stage",id:e.id,name:e.name,isCloud:e.isCloud}}for(const t in r.variables)if(Object.prototype.hasOwnProperty.call(r.variables,t)){const i=r.variables[t];if(i.name===e&&i.type===n)return{scope:"target",id:i.id,name:i.name,isCloud:i.isCloud}}if(!r.isStage&&i)for(const t in i.variables)if(Object.prototype.hasOwnProperty.call(i.variables,t)){const r=i.variables[t];if(r.name===e&&r.type===n)return{scope:"stage",id:r.id,name:r.name,isCloud:r.isCloud}}const s=new o(t,e,n,!1);if(r.variables[t]=s,r.sprite)for(const i of r.sprite.clones)Object.prototype.hasOwnProperty.call(i.variables,t)||(i.variables[t]=new o(t,e,n,!1));return{scope:"target",id:t,name:s.name,isCloud:s.isCloud}}descendProcedure(t){const e=t.mutation.proccode,n=this.blocks.getProcedureParamNamesIdsAndDefaults(e);if(null===n)return{kind:"noop"};const[r,i,s]=n;if(this.runtime.getAddonBlock(e)){this.script.yields=!0;const n={};for(let e=0;e<i.length;e++){let o;o=t.inputs[i[e]]&&t.inputs[i[e]].block?this.descendInputOfBlock(t,i[e]):{kind:"constant",value:s[e]},n[r[e]]=o}return{kind:"addons.call",code:e,arguments:n,blockId:t.id}}const o=this.blocks.getProcedureDefinition(e),a=this.blocks.getBlock(o);if(!a)return{kind:"noop"};const c=this.blocks.getBlock(a.inputs.custom_block.block);let u=this.script.isWarp;if(!u&&c&&c.mutation){const t=c.mutation.warp;"boolean"==typeof t?u=t:"string"==typeof t&&(u=JSON.parse(t))}const l=(h=e,u?"W".concat(h):"Z".concat(h));var h;this.script.dependedProcedures.includes(l)||this.script.dependedProcedures.push(l),this.script.isWarp||e===this.script.procedureCode&&(this.script.yields=!0);const d=[];for(let e=0;e<i.length;e++){let n;n=t.inputs[i[e]]&&t.inputs[i[e]].block?this.descendInputOfBlock(t,i[e]):{kind:"constant",value:s[e]},d.push(n)}return{kind:"procedures.call",code:e,variant:l,arguments:d}}descendCompatLayer(t){this.script.yields=!0;const e={};for(const n of Object.keys(t.inputs))n.startsWith("SUBSTACK")||(e[n]=this.descendInputOfBlock(t,n));const n={};for(const e of Object.keys(t.fields))n[e]=t.fields[e].value;const r=this.getBlockInfo(t.opcode),i=r&&r.info&&r.info.blockType||s.COMMAND,o={};if(i===s.CONDITIONAL||i===s.LOOP)for(const e in t.inputs){if(!e.startsWith("SUBSTACK"))continue;const n="SUBSTACK"===e?1:+e.substring(8);isNaN(n)||(o[n]=this.descendSubstack(t,e))}return{kind:"compat",id:t.id,opcode:t.opcode,blockType:i,inputs:e,fields:n,substacks:o}}analyzeLoop(){this.script.isWarp&&!this.script.warpTimer||(this.script.yields=!0)}readTopBlockComment(t){const e=this.target.comments[t];if(!e)return;const n=e.text;for(const t of n.split("\n")){if(!/^tw\b/.test(t))continue;const e=t.split(" ");for(const t of e)switch(t){case"nocompile":throw new Error("Script explicitly disables compilation");case"stuck":this.script.warpTimer=!0}break}}descendVisualReport(t){if(!this.thread.stackClick||t.next)return null;try{return{kind:"visualReport",input:this.descendInput(t)}}catch(t){return null}}walkHat(t){const e=t.next,n=t.opcode,r=this.runtime._hats[n];if(this.thread.stackClick){return this.runtime.getOpcodeFunction(n)?[this.descendCompatLayer(t),...this.walkStack(e)]:this.walkStack(e)}if(r.edgeActivated)return this.script.yields=!0,this.script.executableHat=!0,[{kind:"hat.edge",id:t.id,condition:this.descendCompatLayer(t)},...this.walkStack(e)];return this.runtime.getOpcodeFunction(n)?(this.script.yields=!0,this.script.executableHat=!0,[{kind:"hat.predicate",condition:this.descendCompatLayer(t)},...this.walkStack(e)]):this.walkStack(e)}generate(t){this.blocks.populateProcedureCache(),this.script.topBlockId=t;const e=this.getBlockById(t);if(!e){if(this.script.isProcedure)return this.script;throw new Error("Cannot find top block")}e.comment&&this.readTopBlockComment(e.comment);if(!!this.runtime._hats[e.opcode])this.script.stack=this.walkHat(e);else{let n;n="procedures_definition"===e.opcode?e.next:t,n&&(this.script.stack=this.walkStack(n))}return this.script}}t.exports={ScriptTreeGenerator:f,IRGenerator:class{constructor(t){this.thread=t,this.blocks=t.blockContainer,this.proceduresToCompile=new Map,this.compilingProcedures=new Map,this.procedures={},this.analyzedProcedures=[]}addProcedureDependencies(t){for(const e of t){if(Object.prototype.hasOwnProperty.call(this.procedures,e))continue;if(this.compilingProcedures.has(e))continue;if(this.proceduresToCompile.has(e))continue;const t=p(e),n=this.blocks.getProcedureDefinition(t);this.proceduresToCompile.set(e,n)}}generateScriptTree(t,e){const n=t.generate(e);return this.addProcedureDependencies(n.dependedProcedures),n}analyzeScript(t){let e=!1;for(const n of t.dependedProcedures){const r=this.procedures[n];this.analyzedProcedures.includes(n)||(this.analyzedProcedures.push(n),this.analyzeScript(r)&&(e=!0),this.analyzedProcedures.pop()),r.yields&&!t.yields&&(t.yields=!0,e=!0)}return e}generate(){const t=this.generateScriptTree(new f(this.thread),this.thread.topBlock),e=this.blocks._cache.compiledProcedures;for(;this.proceduresToCompile.size>0;){this.compilingProcedures=this.proceduresToCompile,this.proceduresToCompile=new Map;for(const[t,n]of this.compilingProcedures.entries())if(e[t]){const n=e[t];this.procedures[t]=n,this.addProcedureDependencies(n.dependedProcedures)}else{const r="W"===t.charAt(0),i=new f(this.thread);i.setProcedureVariant(t),r&&i.enableWarp();const s=this.generateScriptTree(i,n);this.procedures[t]=s,e[t]=s}}for(;this.analyzeScript(t););const n=new u;return n.entry=t,n.procedures=this.procedures,n}}}},function(t,e,n){const r={Timer:n(13),Cast:n(1),log:n(0),blockUtility:n(189),thread:null};let i="";const s={};i+="let stuckCounter = 0;\nconst isStuck = () => {\n    // The real time is not checked on every call for performance.\n    stuckCounter++;\n    if (stuckCounter === 100) {\n        stuckCounter = 0;\n        return globalState.thread.target.runtime.sequencer.timer.timeElapsed() > 500;\n    }\n    return false;\n};",s.startHats="const startHats = (requestedHat, optMatchFields) => {\n    const thread = globalState.thread;\n    const threads = thread.target.runtime.startHats(requestedHat, optMatchFields);\n    return threads;\n}",s.waitThreads="const waitThreads = function*(threads) {\n    const thread = globalState.thread;\n    const runtime = thread.target.runtime;\n\n    while (true) {\n        // determine whether any threads are running\n        let anyRunning = false;\n        for (let i = 0; i < threads.length; i++) {\n            if (runtime.threads.indexOf(threads[i]) !== -1) {\n                anyRunning = true;\n                break;\n            }\n        }\n        if (!anyRunning) {\n            // all threads are finished, can resume\n            return;\n        }\n\n        let allWaiting = true;\n        for (let i = 0; i < threads.length; i++) {\n            if (!runtime.isWaitingThread(threads[i])) {\n                allWaiting = false;\n                break;\n            }\n        }\n        if (allWaiting) {\n            thread.status = 3; // STATUS_YIELD_TICK\n        }\n\n        yield;\n    }\n}",s.executeInCompatibilityLayer="let hasResumedFromPromise = false;\nconst waitPromise = function*(promise) {\n    const thread = globalState.thread;\n    let returnValue;\n\n    // enter STATUS_PROMISE_WAIT and yield\n    // this will stop script execution until the promise handlers reset the thread status\n    // because promise handlers might execute immediately, configure thread.status here\n    thread.status = 1; // STATUS_PROMISE_WAIT\n\n    promise\n        .then(value => {\n            returnValue = value;\n            thread.status = 0; // STATUS_RUNNING\n        }, error => {\n            globalState.log.warn('Promise rejected in compiled script:', error);\n            returnValue = '' + error;\n            thread.status = 0; // STATUS_RUNNING\n        });\n\n    yield;\n\n    return returnValue;\n};\nconst isPromise = value => (\n    // see engine/execute.js\n    value !== null &&\n    typeof value === 'object' &&\n    typeof value.then === 'function'\n);\nconst executeInCompatibilityLayer = function*(inputs, blockFunction, isWarp, useFlags, blockId, branchInfo) {\n    const thread = globalState.thread;\n    const blockUtility = globalState.blockUtility;\n    const stackFrame = branchInfo ? branchInfo.stackFrame : {};\n\n    const finish = (returnValue) => {\n        if (branchInfo) {\n            if (typeof returnValue === 'undefined' && blockUtility._startedBranch) {\n                branchInfo.isLoop = blockUtility._startedBranch[1];\n                return blockUtility._startedBranch[0];\n            }\n            branchInfo.isLoop = branchInfo.defaultIsLoop;\n            return returnValue;\n        }\n        return returnValue;\n    };\n\n    const executeBlock = () => {\n        blockUtility.init(thread, blockId, stackFrame);\n        return blockFunction(inputs, blockUtility);\n    };\n\n    let returnValue = executeBlock();\n    if (isPromise(returnValue)) {\n        returnValue = finish(yield* waitPromise(returnValue));\n        if (useFlags) hasResumedFromPromise = true;\n        return returnValue;\n    }\n\n    if (thread.status === 1 /* STATUS_PROMISE_WAIT */ || thread.status === 4 /* STATUS_DONE */) {\n        // Something external is forcing us to stop\n        yield;\n        // Make up a return value because whatever is forcing us to stop can't specify one\n        return '';\n    }\n\n    while (thread.status === 2 /* STATUS_YIELD */ || thread.status === 3 /* STATUS_YIELD_TICK */) {\n        // Yielded threads will run next iteration.\n        if (thread.status === 2 /* STATUS_YIELD */) {\n            thread.status = 0; // STATUS_RUNNING\n            // Yield back to the event loop when stuck or not in warp mode.\n            if (!isWarp || isStuck()) {\n                yield;\n            }\n        } else {\n            // status is STATUS_YIELD_TICK, always yield to the event loop\n            yield;\n        }\n\n        returnValue = executeBlock();\n        if (isPromise(returnValue)) {\n            returnValue = finish(yield* waitPromise(returnValue));\n            if (useFlags) hasResumedFromPromise = true;\n            return returnValue;\n        }\n\n        if (thread.status === 1 /* STATUS_PROMISE_WAIT */ || thread.status === 4 /* STATUS_DONE */) {\n            yield;\n            return finish('');\n        }\n    }\n\n    return finish(returnValue);\n}",s.createBranchInfo="const createBranchInfo = (isLoop) => ({\n    defaultIsLoop: isLoop,\n    isLoop: false,\n    branch: 0,\n    stackFrame: {}\n});",s.retire="const retire = () => {\n    const thread = globalState.thread;\n    thread.target.runtime.sequencer.retireThread(thread);\n}",s.toBoolean="const toBoolean = value => {\n    if (typeof value === 'boolean') {\n        return value;\n    }\n    if (typeof value === 'string') {\n        if (value === '' || value === '0' || value.toLowerCase() === 'false') {\n            return false;\n        }\n        return true;\n    }\n    return !!value;\n}",s.limitPrecision="const limitPrecision = value => {\n    const rounded = Math.round(value);\n    const delta = value - rounded;\n    return (Math.abs(delta) < 1e-9) ? rounded : value;\n}",i+="const isNotActuallyZero = val => {\n    if (typeof val !== 'string') return false;\n    for (let i = 0; i < val.length; i++) {\n        const code = val.charCodeAt(i);\n        if (code === 48 || code === 9) {\n            return false;\n        }\n    }\n    return true;\n};",i+="const compareEqualSlow = (v1, v2) => {\n    const n1 = +v1;\n    if (isNaN(n1) || (n1 === 0 && isNotActuallyZero(v1))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n    const n2 = +v2;\n    if (isNaN(n2) || (n2 === 0 && isNotActuallyZero(v2))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n    return n1 === n2;\n};\nconst compareEqual = (v1, v2) => (typeof v1 === 'number' && typeof v2 === 'number' && !isNaN(v1) && !isNaN(v2) || v1 === v2) ? v1 === v2 : compareEqualSlow(v1, v2);",s.compareGreaterThan="const compareGreaterThanSlow = (v1, v2) => {\n    let n1 = +v1;\n    let n2 = +v2;\n    if (n1 === 0 && isNotActuallyZero(v1)) {\n        n1 = NaN;\n    } else if (n2 === 0 && isNotActuallyZero(v2)) {\n        n2 = NaN;\n    }\n    if (isNaN(n1) || isNaN(n2)) {\n        const s1 = ('' + v1).toLowerCase();\n        const s2 = ('' + v2).toLowerCase();\n        return s1 > s2;\n    }\n    return n1 > n2;\n};\nconst compareGreaterThan = (v1, v2) => typeof v1 === 'number' && typeof v2 === 'number' && !isNaN(v1) ? v1 > v2 : compareGreaterThanSlow(v1, v2)",s.compareLessThan="const compareLessThanSlow = (v1, v2) => {\n    let n1 = +v1;\n    let n2 = +v2;\n    if (n1 === 0 && isNotActuallyZero(v1)) {\n        n1 = NaN;\n    } else if (n2 === 0 && isNotActuallyZero(v2)) {\n        n2 = NaN;\n    }\n    if (isNaN(n1) || isNaN(n2)) {\n        const s1 = ('' + v1).toLowerCase();\n        const s2 = ('' + v2).toLowerCase();\n        return s1 < s2;\n    }\n    return n1 < n2;\n};\nconst compareLessThan = (v1, v2) => typeof v1 === 'number' && typeof v2 === 'number' && !isNaN(v2) ? v1 < v2 : compareLessThanSlow(v1, v2)",s.randomInt="const randomInt = (low, high) => low + Math.floor(Math.random() * ((high + 1) - low))",s.randomFloat="const randomFloat = (low, high) => (Math.random() * (high - low)) + low",s.timer="const timer = () => {\n    const t = new globalState.Timer({\n        now: () => globalState.thread.target.runtime.currentMSecs\n    });\n    t.start();\n    return t;\n}",s.daysSince2000="const daysSince2000 = () => (Date.now() - 946684800000) / (24 * 60 * 60 * 1000)",s.distance="const distance = menu => {\n    const thread = globalState.thread;\n    if (thread.target.isStage) return 10000;\n\n    let targetX = 0;\n    let targetY = 0;\n    if (menu === '_mouse_') {\n        targetX = thread.target.runtime.ioDevices.mouse.getScratchX();\n        targetY = thread.target.runtime.ioDevices.mouse.getScratchY();\n    } else {\n        const distTarget = thread.target.runtime.getSpriteTargetByName(menu);\n        if (!distTarget) return 10000;\n        targetX = distTarget.x;\n        targetY = distTarget.y;\n    }\n\n    const dx = thread.target.x - targetX;\n    const dy = thread.target.y - targetY;\n    return Math.sqrt((dx * dx) + (dy * dy));\n}",i+="const listIndexSlow = (index, length) => {\n    if (index === 'last') {\n        return length - 1;\n    } else if (index === 'random' || index === 'any') {\n        if (length > 0) {\n            return (Math.random() * length) | 0;\n        }\n        return -1;\n    }\n    index = (+index || 0) | 0;\n    if (index < 1 || index > length) {\n        return -1;\n    }\n    return index - 1;\n};\nconst listIndex = (index, length) => {\n    if (typeof index !== 'number') {\n      return listIndexSlow(index, length);\n    }\n    index = index | 0;\n    return index < 1 || index > length ? -1 : index - 1;\n};",s.listGet="const listGet = (list, idx) => {\n    const index = listIndex(idx, list.length);\n    if (index === -1) {\n        return '';\n    }\n    return list[index];\n}",s.listReplace="const listReplace = (list, idx, value) => {\n    const index = listIndex(idx, list.value.length);\n    if (index === -1) {\n        return;\n    }\n    list.value[index] = value;\n    list._monitorUpToDate = false;\n}",s.listInsert="const listInsert = (list, idx, value) => {\n    const index = listIndex(idx, list.value.length + 1);\n    if (index === -1) {\n        return;\n    }\n    list.value.splice(index, 0, value);\n    list._monitorUpToDate = false;\n}",s.listDelete="const listDelete = (list, idx) => {\n    if (idx === 'all') {\n        list.value = [];\n        return;\n    }\n    const index = listIndex(idx, list.value.length);\n    if (index === -1) {\n        return;\n    }\n    list.value.splice(index, 1);\n    list._monitorUpToDate = false;\n}",s.listContains="const listContains = (list, item) => {\n    // TODO: evaluate whether indexOf is worthwhile here\n    if (list.value.indexOf(item) !== -1) {\n        return true;\n    }\n    for (let i = 0; i < list.value.length; i++) {\n        if (compareEqual(list.value[i], item)) {\n            return true;\n        }\n    }\n    return false;\n}",s.listIndexOf="const listIndexOf = (list, item) => {\n    for (let i = 0; i < list.value.length; i++) {\n        if (compareEqual(list.value[i], item)) {\n            return i + 1;\n        }\n    }\n    return 0;\n}",s.listContents="const listContents = list => {\n    for (let i = 0; i < list.value.length; i++) {\n        const listItem = list.value[i];\n        // this is an intentional break from what scratch 3 does to address our automatic string -> number conversions\n        // it fixes more than it breaks\n        if ((listItem + '').length !== 1) {\n            return list.value.join(' ');\n        }\n    }\n    return list.value.join('');\n}",s.colorToList="const colorToList = color => globalState.Cast.toRgbColorList(color)",s.mod="const mod = (n, modulus) => {\n    let result = n % modulus;\n    if (result / modulus < 0) result += modulus;\n    return result;\n}",s.tan="const tan = (angle) => {\n    switch (angle % 360) {\n    case -270: case 90: return Infinity;\n    case -90: case 270: return -Infinity;\n    }\n    return Math.round(Math.tan((Math.PI * angle) / 180) * 1e10) / 1e10;\n}",s.yieldThenCall="const yieldThenCall = function* (callback, ...args) {\n    yield;\n    return callback(...args);\n}",s.yieldThenCallGenerator="const yieldThenCallGenerator = function* (callback, ...args) {\n    yield;\n    return yield* callback(...args);\n}";const o=t=>{r.thread=t,t.generator.next()},a=[];o.scopedEval=t=>{const e=(t=>{let e="let stuckCounter = 0;\nconst isStuck = () => {\n    // The real time is not checked on every call for performance.\n    stuckCounter++;\n    if (stuckCounter === 100) {\n        stuckCounter = 0;\n        return globalState.thread.target.runtime.sequencer.timer.timeElapsed() > 500;\n    }\n    return false;\n};const isNotActuallyZero = val => {\n    if (typeof val !== 'string') return false;\n    for (let i = 0; i < val.length; i++) {\n        const code = val.charCodeAt(i);\n        if (code === 48 || code === 9) {\n            return false;\n        }\n    }\n    return true;\n};const compareEqualSlow = (v1, v2) => {\n    const n1 = +v1;\n    if (isNaN(n1) || (n1 === 0 && isNotActuallyZero(v1))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n    const n2 = +v2;\n    if (isNaN(n2) || (n2 === 0 && isNotActuallyZero(v2))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n    return n1 === n2;\n};\nconst compareEqual = (v1, v2) => (typeof v1 === 'number' && typeof v2 === 'number' && !isNaN(v1) && !isNaN(v2) || v1 === v2) ? v1 === v2 : compareEqualSlow(v1, v2);const listIndexSlow = (index, length) => {\n    if (index === 'last') {\n        return length - 1;\n    } else if (index === 'random' || index === 'any') {\n        if (length > 0) {\n            return (Math.random() * length) | 0;\n        }\n        return -1;\n    }\n    index = (+index || 0) | 0;\n    if (index < 1 || index > length) {\n        return -1;\n    }\n    return index - 1;\n};\nconst listIndex = (index, length) => {\n    if (typeof index !== 'number') {\n      return listIndexSlow(index, length);\n    }\n    index = index | 0;\n    return index < 1 || index > length ? -1 : index - 1;\n};";for(const n of Object.keys(s))t.includes(n)&&(e+="".concat(s[n],";"));return e+="return ".concat(t),e})(t);try{return new Function("globalState",e)(r)}catch(t){throw r.log.error("was unable to compile script",e),t}},o.runtimeFunctions=s,o.saveGlobalState=()=>{a.push(r.thread)},o.restoreGlobalState=()=>{r.thread=a.pop()},t.exports=o},function(t,e,n){const r=n(67),i=n(63),s=n(0),o=n(22),{Map:a}=n(21),c=n(1),u=new r;let l=-1;const h=function(t,e,n,r,i){const s=r.id,u=r.opcode,l=r._isHat,h=r._isConditional,d=r._isLoop;if(n.pushReportedValue(t),l)if(n.stackClick)n.status=o.STATUS_RUNNING;else if(e.runtime.getIsEdgeActivatedHat(u)){const r=n.target.hasEdgeActivatedValue(s),i=n.target.updateEdgeActivatedValue(s,t);(r?!i&&t:t)?n.status=o.STATUS_RUNNING:e.retireThread(n)}else t?n.status=o.STATUS_RUNNING:e.retireThread(n);else if((h||d)&&void 0!==t)e.stepToBranch(n,c.toNumber(t),d);else{if(i&&void 0!==t&&n.atStackTop()&&(n.stackClick&&e.runtime.visualReport(n.target,s,t),n.updateMonitor)){const n=e.runtime.monitorBlocks.getBlock(s).targetId;if(n&&!e.runtime.getTargetById(n))return;e.runtime.requestUpdateMonitor(a({id:s,spriteName:n?e.runtime.getTargetById(n).getName():null,value:t}))}n.status=o.STATUS_RUNNING}},d=(t,e,n,r,i)=>{if(h(t,e,n,r,i),i&&(!r._isHat||n.stackClick)){let t,e;do{const r=n.popStack();if(null===r)return;if(e=n.target.blocks.getNextBlock(r),null!==e)break;t=n.peekStackFrame()}while(null!==t&&!t.isLoop);n.pushStack(e)}},p=(t,e,n,r,i)=>{n.status===o.STATUS_RUNNING&&(n.status=o.STATUS_PROMISE_WAIT),t.then((t=>{d(t,e,n,r,i)}),(t=>{s.warn("Primitive rejected promise: ",t),d("".concat(t),e,n,r,i)}))};class f{constructor(t,e){this.id=e.id,this.opcode=e.opcode,this.fields=e.fields,this.inputs=e.inputs,this.mutation=e.mutation,this._profiler=null,this._profilerFrame=null,this._isHat=!1,this._blockFunction=null,this._definedBlockFunction=!1,this._isShadowBlock=!1,this._shadowValue=null,this._fields=Object.assign({},this.fields),this._inputs=Object.assign({},this.inputs),this._argValues={mutation:this.mutation},this._parentKey=null,this._parentValues=null,this._ops=[];const{runtime:n}=u.sequencer,{opcode:r,fields:s,inputs:o}=this;this._isHat=n.getIsHat(r),this._blockFunction=n.getOpcodeFunction(r),this._definedBlockFunction=void 0!==this._blockFunction;const a=n._flowing[r];this._isConditional=!(!a||!a.conditional),this._isLoop=!(!a||!a.loop);const c=Object.keys(s);this._isShadowBlock=!this._definedBlockFunction&&1===c.length&&0===Object.keys(o).length,this._shadowValue=this._isShadowBlock&&s[c[0]].value;for(const t in s)this._argValues[t]="VARIABLE"===t||"LIST"===t||"BROADCAST_OPTION"===t?{id:s[t].id,name:s[t].value}:s[t].value;if(delete this._inputs.custom_block,"BROADCAST_INPUT"in this._inputs){this._argValues.BROADCAST_OPTION={id:null,name:null};const e=this._inputs.BROADCAST_INPUT;if(e.block===e.shadow){const n=t.getBlock(e.shadow).fields.BROADCAST_OPTION;this._argValues.BROADCAST_OPTION.id=n.id,this._argValues.BROADCAST_OPTION.name=n.value,delete this._inputs.BROADCAST_INPUT}}for(const e in this._inputs){const n=this._inputs[e];if(n.block){const r=i.getCached(t,n.block,f);if(r._isHat)continue;this._ops.push(...r._ops),r._parentKey=e,r._parentValues=this._argValues,r._isShadowBlock&&(this._argValues[e]=r._shadowValue)}}this._definedBlockFunction&&this._ops.push(this)}}t.exports=function(t,e){const n=t.runtime;u.sequencer=t,u.thread=e;const r=e.peekStack(),s=e.peekStackFrame();let a=e.blockContainer,d=i.getCached(a,r,f);if(null===d&&(a=n.flyoutBlocks,d=i.getCached(a,r,f),null===d))return void t.retireThread(e);const m=d._ops,g=m.length;let b=0;if(null!==s.reported){const t=s.reported;for(;b<t.length;b++){const{opCached:e,inputValue:n}=t[b],r=m.find((t=>t.id===e));if(r){const t=r._parentKey,e=r._parentValues;"BROADCAST_INPUT"===t?(e.BROADCAST_OPTION.id=null,e.BROADCAST_OPTION.name=c.toString(n)):e[t]=n}}if(t.length>0){const e=t.reverse().find((t=>m.find((e=>e.id===t.opCached))));b=e?m.findIndex((t=>t.id===e.opCached))+1:0}if(null!==e.justReported&&m[b]&&m[b].id===s.reporting){const t=m[b],n=e.justReported;e.justReported=null;const r=t._parentKey,i=t._parentValues;"BROADCAST_INPUT"===r?(i.BROADCAST_OPTION.id=null,i.BROADCAST_OPTION.name=c.toString(n)):i[r]=n,b+=1}s.reporting=null,s.reported=null,s.waitingReporter=!1}const y=b;for(;b<g;b++){const n=b===g-1,r=m[b];s.op=r;const i=r._blockFunction,l=r._argValues;a.forceNoGlow||(e.requestScriptGlowInFrame=!0);const d=i(l,u),f=null!==(v=d)&&"object"==typeof v&&"function"==typeof v.then;if(f||s.waitingReporter){f&&p(d,t,e,r,n),e.justReported=null,s.reporting=m[b].id,s.reported=m.slice(0,b).map((t=>{const e=t._parentKey,n=t._parentValues;return"BROADCAST_INPUT"===e?{opCached:t.id,inputValue:n[e].BROADCAST_OPTION.name}:{opCached:t.id,inputValue:n[e]}}));break}if(e.status===o.STATUS_RUNNING)if(n)h(d,t,e,r,n);else{const t=r._parentKey,e=r._parentValues;"BROADCAST_INPUT"===t?(e.BROADCAST_OPTION.id=null,e.BROADCAST_OPTION.name=c.toString(d)):e[t]=d}else if(e.status===o.STATUS_DONE)break}var v;if(null!==n.profiler){d._profiler!==n.profiler&&function(t,e){e._profiler=t,-1===l&&(l=t.idByName("blockFunction"));const n=e._ops;for(let e=0;e<n.length;e++)n[e]._profilerFrame=t.frame(l,n[e].opcode)}(n.profiler,d);const t=Math.min(b+1,g);for(let e=y;e<t;e++)m[e]._profilerFrame.count+=1}}},function(t,e,n){const r=n(4),i=n(6),s=n(1),o=n(11),a=n(230),c=n(12);class u extends a{constructor(t,e){super(e,t.blocks),this.sprite=t,this.renderer=null,this.runtime&&(this.renderer=this.runtime.renderer),this.drawableID=null,this.dragging=!1,this.effects={color:0,fisheye:0,whirl:0,pixelate:0,mosaic:0,brightness:0,ghost:0},this.isOriginal=!0,this.isStage=!1,this.x=0,this.y=0,this.direction=90,this.draggable=!1,this.visible=!0,this.size=100,this.currentCostume=0,this.rotationStyle=u.ROTATION_STYLE_ALL_AROUND,this.volume=100,this.tempo=60,this.videoTransparency=50,this.videoState=u.VIDEO_STATE.ON,this.textToSpeechLanguage=null,this.onTargetMoved=null,this.onTargetVisualChange=null,this.interpolationData=null}initDrawable(t){this.renderer&&(this.drawableID=this.renderer.createDrawable(t)),this.isOriginal||this.runtime.startHats("control_start_as_clone",null,this)}get audioPlayer(){console.warn("get audioPlayer deprecated, please update to use .sprite.soundBank methods"),console.warn(new Error("stack for debug").stack);const t=this.sprite.soundBank,e={playSound:e=>t.play(this,e)};return Object.defineProperty(this,"audioPlayer",{configurable:!1,enumerable:!0,writable:!1,value:e}),e}initAudio(){}static get ROTATION_STYLE_ALL_AROUND(){return"all around"}static get ROTATION_STYLE_LEFT_RIGHT(){return"left-right"}static get ROTATION_STYLE_NONE(){return"don't rotate"}static get VIDEO_STATE(){return{OFF:"off",ON:"on",ON_FLIPPED:"on-flipped"}}emitVisualChange(){this.onTargetVisualChange&&this.onTargetVisualChange(this)}setXY(t,e,n){if(this.isStage)return;if(this.dragging&&!n)return;const r=this.x,i=this.y;if(this.renderer){const n=this.runtime.runtimeOptions.fencing?this.renderer.getFencedPositionOfDrawable(this.drawableID,[t,e]):[t,e];this.x=n[0],this.y=n[1],this.renderer.updateDrawablePosition(this.drawableID,n),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}else this.x=t,this.y=e;this.onTargetMoved&&this.onTargetMoved(this,r,i,n),this.runtime.requestTargetsUpdate(this)}_getRenderedDirectionAndScale(){let t=this.direction,e=[this.size,this.size];if(this.rotationStyle===u.ROTATION_STYLE_NONE)t=90;else if(this.rotationStyle===u.ROTATION_STYLE_LEFT_RIGHT){t=90;e=[(this.direction<0?-1:1)*this.size,this.size]}return{direction:t,scale:e}}setDirection(t){if(!this.isStage&&isFinite(t)){if(this.direction=r.wrapClamp(t,-179,180),this.renderer){const{direction:t,scale:e}=this._getRenderedDirectionAndScale();this.renderer.updateDrawableDirectionScale(this.drawableID,t,e),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}this.runtime.requestTargetsUpdate(this)}}setDraggable(t){this.isStage||(this.draggable=!!t,this.runtime.requestTargetsUpdate(this))}setVisible(t){this.isStage||(this.visible=!!t,this.renderer&&(this.renderer.updateDrawableVisible(this.drawableID,this.visible),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())),this.runtime.requestTargetsUpdate(this))}setSize(t){if(!this.isStage){if(this.renderer){const e=this.renderer.getCurrentSkinSize(this.drawableID),n=e[0],i=e[1],s=this.runtime.runtimeOptions.fencing,o=s?Math.min(1,Math.max(5/n,5/i)):0,a=s?Math.min(1.5*this.runtime.stageWidth/n,1.5*this.runtime.stageHeight/i):1/0;this.size=100*r.clamp(t/100,o,a);const{direction:c,scale:u}=this._getRenderedDirectionAndScale();this.renderer.updateDrawableDirectionScale(this.drawableID,c,u),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}else this.size=t;this.runtime.requestTargetsUpdate(this)}}setEffect(t,e){Object.prototype.hasOwnProperty.call(this.effects,t)&&(this.effects[t]=e,this.renderer&&(this.renderer.updateDrawableEffect(this.drawableID,t,e),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())))}clearEffects(){for(const t in this.effects)Object.prototype.hasOwnProperty.call(this.effects,t)&&(this.effects[t]=0);if(this.renderer){for(const t in this.effects)Object.prototype.hasOwnProperty.call(this.effects,t)&&this.renderer.updateDrawableEffect(this.drawableID,t,0);this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}}setCostume(t){if((t=Math.round(t))!==1/0&&t!==-1/0&&t||(t=0),this.currentCostume=r.wrapClamp(t,0,this.sprite.costumes.length-1),this.renderer){const t=this.sprite.costumes[this.currentCostume];this.renderer.updateDrawableSkinId(this.drawableID,t.skinId),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}this.runtime.requestTargetsUpdate(this)}addCostume(t,e){"number"!=typeof e||isNaN(e)?this.sprite.addCostumeAt(t,this.sprite.costumes.length):this.sprite.addCostumeAt(t,e)}renameCostume(t,e){const n=this.sprite.costumes.filter(((e,n)=>t!==n)).map((t=>t.name)),r=this.getCostumes()[t].name,s=i.unusedName(e,n);if(this.getCostumes()[t].name=s,this.isStage){const t=this.runtime.targets;for(let e=0;e<t.length;e++){t[e].blocks.updateAssetName(r,s,"backdrop")}}else this.blocks.updateAssetName(r,s,"costume")}deleteCostume(t){const e=this.sprite.costumes.length;if(1===e)return null;if(t<0||t>=e)return null;const n=this.sprite.deleteCostumeAt(t);return t===this.currentCostume&&t===e-1?this.setCostume(t-1):t<this.currentCostume?this.setCostume(this.currentCostume-1):this.setCostume(this.currentCostume),this.runtime.requestTargetsUpdate(this),n}addSound(t,e){const n=this.sprite.sounds.map((t=>t.name));t.name=i.unusedName(t.name,n),"number"!=typeof e||isNaN(e)?this.sprite.sounds.push(t):this.sprite.sounds.splice(e,0,t)}renameSound(t,e){const n=this.sprite.sounds.filter(((e,n)=>t!==n)).map((t=>t.name)),r=this.sprite.sounds[t].name,s=i.unusedName(e,n);this.sprite.sounds[t].name=s,this.blocks.updateAssetName(r,s,"sound")}deleteSound(t){if(t<0||t>=this.sprite.sounds.length)return null;const e=this.sprite.sounds.splice(t,1)[0];return this.runtime.requestTargetsUpdate(this),e}setRotationStyle(t){if(t===u.ROTATION_STYLE_NONE?this.rotationStyle=u.ROTATION_STYLE_NONE:t===u.ROTATION_STYLE_ALL_AROUND?this.rotationStyle=u.ROTATION_STYLE_ALL_AROUND:t===u.ROTATION_STYLE_LEFT_RIGHT&&(this.rotationStyle=u.ROTATION_STYLE_LEFT_RIGHT),this.renderer){const{direction:t,scale:e}=this._getRenderedDirectionAndScale();this.renderer.updateDrawableDirectionScale(this.drawableID,t,e),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}this.runtime.requestTargetsUpdate(this)}getCostumeIndexByName(t){const e=this.getCostumes();for(let n=0;n<e.length;n++)if(e[n].name===t)return n;return-1}getCurrentCostume(){return this.getCostumes()[this.currentCostume]}getCostumes(){return this.sprite.costumes}reorderCostume(t,e){if((e=r.clamp(e,0,this.sprite.costumes.length-1))===(t=r.clamp(t,0,this.sprite.costumes.length-1)))return!1;const n=this.getCurrentCostume(),i=this.sprite.costumes[t];return this.sprite.deleteCostumeAt(t),this.addCostume(i,e),this.currentCostume=this.getCostumeIndexByName(n.name),!0}reorderSound(t,e){if((e=r.clamp(e,0,this.sprite.sounds.length-1))===(t=r.clamp(t,0,this.sprite.sounds.length-1)))return!1;const n=this.sprite.sounds[t];return this.deleteSound(t),this.addSound(n,e),!0}getSounds(){return this.sprite.sounds}updateAllDrawableProperties(){if(this.renderer){const{direction:t,scale:e}=this._getRenderedDirectionAndScale();this.renderer.updateDrawablePosition(this.drawableID,[this.x,this.y]),this.renderer.updateDrawableDirectionScale(this.drawableID,t,e),this.renderer.updateDrawableVisible(this.drawableID,this.visible);const n=this.getCostumes()[this.currentCostume];this.renderer.updateDrawableSkinId(this.drawableID,n.skinId);for(const t in this.effects)Object.prototype.hasOwnProperty.call(this.effects,t)&&this.renderer.updateDrawableEffect(this.drawableID,t,this.effects[t]);this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}this.runtime.requestTargetsUpdate(this)}getName(){return this.sprite.name}isSprite(){return!this.isStage&&this.isOriginal}getBounds(){return this.renderer?this.runtime.renderer.getBounds(this.drawableID):null}getBoundsForBubble(){return this.renderer?this.runtime.renderer.getBoundsForBubble(this.drawableID):null}isTouchingObject(t){if("_mouse_"===t){if(!this.runtime.ioDevices.mouse)return!1;const t=this.runtime.ioDevices.mouse.getClientX(),e=this.runtime.ioDevices.mouse.getClientY();return this.isTouchingPoint(t,e)}return"_edge_"===t?this.isTouchingEdge():this.isTouchingSprite(t)}isTouchingPoint(t,e){return!!this.renderer&&this.renderer.drawableTouching(this.drawableID,t,e)}isTouchingEdge(){if(this.renderer){const t=this.runtime.stageWidth,e=this.runtime.stageHeight,n=this.getBounds();if(n.left<-t/2||n.right>t/2||n.top>e/2||n.bottom<-e/2)return!0}return!1}isTouchingSprite(t){t=s.toString(t);const e=this.runtime.getSpriteTargetByName(t);if(!e||!this.renderer)return!1;const n=e.sprite.clones.filter((t=>!t.dragging)).map((t=>t.drawableID));return this.renderer.isTouchingDrawables(this.drawableID,n)}isTouchingColor(t){return!!this.renderer&&this.renderer.isTouchingColor(this.drawableID,t)}colorIsTouchingColor(t,e){return!!this.renderer&&this.renderer.isTouchingColor(this.drawableID,t,e)}getLayerOrder(){return this.renderer?this.renderer.getDrawableOrder(this.drawableID):null}goToFront(){this.renderer&&this.renderer.setDrawableOrder(this.drawableID,1/0,c.SPRITE_LAYER),this.runtime.setExecutablePosition(this,1/0)}goToBack(){this.renderer&&this.renderer.setDrawableOrder(this.drawableID,-1/0,c.SPRITE_LAYER,!1),this.runtime.setExecutablePosition(this,-1/0)}goForwardLayers(t){this.renderer&&this.renderer.setDrawableOrder(this.drawableID,t,c.SPRITE_LAYER,!0),this.runtime.moveExecutable(this,t)}goBackwardLayers(t){this.renderer&&this.renderer.setDrawableOrder(this.drawableID,-t,c.SPRITE_LAYER,!0),this.runtime.moveExecutable(this,-t)}goBehindOther(t){if(this.renderer){const e=this.renderer.setDrawableOrder(t.drawableID,0,c.SPRITE_LAYER,!0);this.renderer.setDrawableOrder(this.drawableID,e,c.SPRITE_LAYER)}const e=this.runtime.executableTargets.indexOf(t);this.runtime.setExecutablePosition(this,e)}keepInFence(t,e,n){let r=n;r||(r={left:-this.runtime.stageWidth/2,right:this.runtime.stageWidth/2,top:this.runtime.stageHeight/2,bottom:-this.runtime.stageHeight/2});const i=this.getBounds();if(!i)return;i.left+=t-this.x,i.right+=t-this.x,i.top+=e-this.y,i.bottom+=e-this.y;let s=0,o=0;return i.left<r.left&&(s+=r.left-i.left),i.right>r.right&&(s+=r.right-i.right),i.top>r.top&&(o+=r.top-i.top),i.bottom<r.bottom&&(o+=r.bottom-i.bottom),[t+s,e+o]}makeClone(){if(!this.runtime.clonesAvailable()||this.isStage)return null;this.runtime.changeCloneCounter(1);const t=this.sprite.createClone();return t.x=this.x,t.y=this.y,t.direction=this.direction,t.draggable=this.draggable,t.visible=this.visible,t.size=this.size,t.currentCostume=this.currentCostume,t.rotationStyle=this.rotationStyle,t.effects=o.simple(this.effects),t.variables=this.duplicateVariables(),t._edgeActivatedHatValues=o.simple(this._edgeActivatedHatValues),t.initDrawable(c.SPRITE_LAYER),t.updateAllDrawableProperties(),t}duplicate(){return this.sprite.duplicate().then((t=>{const e=t.createClone();return e.x=400*(Math.random()-.5)/2,e.y=300*(Math.random()-.5)/2,e.direction=this.direction,e.draggable=this.draggable,e.visible=this.visible,e.size=this.size,e.currentCostume=this.currentCostume,e.rotationStyle=this.rotationStyle,e.effects=JSON.parse(JSON.stringify(this.effects)),e.variables=this.duplicateVariables(e.blocks),e.updateAllDrawableProperties(),e}))}onGreenFlag(){this.clearEffects()}onStopAll(){this.clearEffects()}postSpriteInfo(t){const e=Object.prototype.hasOwnProperty.call(t,"force")?t.force:null,n=Object.prototype.hasOwnProperty.call(t,"x"),r=Object.prototype.hasOwnProperty.call(t,"y");(n||r)&&this.setXY(n?t.x:this.x,r?t.y:this.y,e),Object.prototype.hasOwnProperty.call(t,"direction")&&this.setDirection(t.direction),Object.prototype.hasOwnProperty.call(t,"draggable")&&this.setDraggable(t.draggable),Object.prototype.hasOwnProperty.call(t,"rotationStyle")&&this.setRotationStyle(t.rotationStyle),Object.prototype.hasOwnProperty.call(t,"visible")&&this.setVisible(t.visible),Object.prototype.hasOwnProperty.call(t,"size")&&this.setSize(t.size)}startDrag(){this.dragging=!0}stopDrag(){this.dragging=!1}toJSON(){const t=this.getCostumes();return{id:this.id,name:this.getName(),isStage:this.isStage,x:this.x,y:this.y,size:this.size,direction:this.direction,draggable:this.draggable,currentCostume:this.currentCostume,costume:t[this.currentCostume],costumeCount:t.length,visible:this.visible,rotationStyle:this.rotationStyle,comments:this.comments,blocks:this.blocks._blocks,variables:this.variables,costumes:t,sounds:this.getSounds(),textToSpeechLanguage:this.textToSpeechLanguage,tempo:this.tempo,volume:this.volume,videoTransparency:this.videoTransparency,videoState:this.videoState}}dispose(){this.isOriginal||this.runtime.changeCloneCounter(-1),this.runtime.stopForTarget(this),this.runtime.removeExecutable(this),this.sprite.removeClone(this),this.renderer&&null!==this.drawableID&&(this.renderer.destroyDrawable(this.drawableID,this.isStage?c.BACKGROUND_LAYER:c.SPRITE_LAYER),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw()))}}t.exports=u},function(t,e,n){const r=n(7),i=n(29);class s{constructor(t,e,n,i,o,a,c){this.id=t||r(),this.text=e,this.x=n,this.y=i,this.width=Math.max(Number(o),s.MIN_WIDTH),this.height=Math.max(Number(a),s.MIN_HEIGHT),this.minimized=c||!1,this.blockId=null}toXML(){return'<comment id="'.concat(this.id,'" x="').concat(this.x,'" y="').concat(this.y,'" w="').concat(this.width,'" h="').concat(this.height,'" pinned="').concat(null!==this.blockId,'" minimized="').concat(this.minimized,'">').concat(i(this.text),"</comment>")}static get MIN_WIDTH(){return 20}static get MIN_HEIGHT(){return 20}static get DEFAULT_WIDTH(){return 100}static get DEFAULT_HEIGHT(){return 100}}t.exports=s},function(t,e,n){const r=n(45),i=n(15),{loadSoundFromAsset:s}=n(30),{loadCostumeFromAsset:o}=n(31),a=n(79),c=n(6),u=n(12);class l{constructor(t,e){this.runtime=e,t||(t=new i(e)),this.blocks=t,this.name="",this.costumes_=[],this.sounds=[],this.clones=[],this.soundBank=null,this.runtime&&this.runtime.audioEngine&&(this.soundBank=this.runtime.audioEngine.createBank())}set costumes(t){this.costumes_=[];for(const e of t)this.addCostumeAt(e,this.costumes_.length)}get costumes(){return this.costumes_}addCostumeAt(t,e){t.name||(t.name="");const n=this.costumes_.map((t=>t.name));t.name=c.unusedName(t.name,n),this.costumes_.splice(e,0,t)}deleteCostumeAt(t){return this.costumes.splice(t,1)[0]}createClone(t){const e=new r(this,this.runtime);if(e.isOriginal=0===this.clones.length,this.clones.push(e),e.initAudio(),e.isOriginal){const n="string"==typeof t?t:u.SPRITE_LAYER;e.initDrawable(n),this.runtime.fireTargetWasCreated(e)}else this.runtime.fireTargetWasCreated(e,this.clones[0]);return e}removeClone(t){this.runtime.fireTargetWasRemoved(t);const e=this.clones.indexOf(t);e>=0&&this.clones.splice(e,1)}duplicate(){const t=new l(null,this.runtime),e=this.blocks._blocks,n=Object.keys(e).map((t=>e[t])),r=JSON.parse(JSON.stringify(n));a(r),r.forEach((e=>{t.blocks.createBlock(e)}));const i=this.runtime.targets.map((t=>t.sprite.name));t.name=c.unusedName(this.name,i);const u=[];return t.costumes=this.costumes_.map((t=>{const e=Object.assign({},t);return u.push(o(e,this.runtime)),e})),t.sounds=this.sounds.map((e=>{const n=Object.assign({},e),r=e.asset;return u.push(s(n,r,this.runtime,t.soundBank)),n})),Promise.all(u).then((()=>t))}dispose(){this.soundBank&&this.soundBank.dispose()}}t.exports=l},function(t,e,n){t.exports=function(){"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,n){return e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},e(t,n)}function n(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function r(t,i,s){return r=n()?Reflect.construct:function(t,n,r){var i=[null];i.push.apply(i,n);var s=new(Function.bind.apply(t,i));return r&&e(s,r.prototype),s},r.apply(null,arguments)}function i(t){return s(t)||o(t)||a(t)||u()}function s(t){if(Array.isArray(t))return c(t)}function o(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function a(t,e){if(t){if("string"==typeof t)return c(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(t,e):void 0}}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l=Object.hasOwnProperty,h=Object.setPrototypeOf,d=Object.isFrozen,p=Object.getPrototypeOf,f=Object.getOwnPropertyDescriptor,m=Object.freeze,g=Object.seal,b=Object.create,y="undefined"!=typeof Reflect&&Reflect,v=y.apply,w=y.construct;v||(v=function(t,e,n){return t.apply(e,n)}),m||(m=function(t){return t}),g||(g=function(t){return t}),w||(w=function(t,e){return r(t,i(e))});var T=R(Array.prototype.forEach),E=R(Array.prototype.pop),A=R(Array.prototype.push),k=R(String.prototype.toLowerCase),I=R(String.prototype.toString),S=R(String.prototype.match),x=R(String.prototype.replace),O=R(String.prototype.indexOf),M=R(String.prototype.trim),N=R(RegExp.prototype.test),C=D(TypeError);function R(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return v(t,e,r)}}function D(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return w(t,n)}}function P(t,e,n){var r;n=null!==(r=n)&&void 0!==r?r:k,h&&h(t,null);for(var i=e.length;i--;){var s=e[i];if("string"==typeof s){var o=n(s);o!==s&&(d(e)||(e[i]=o),s=o)}t[s]=!0}return t}function L(t){var e,n=b(null);for(e in t)!0===v(l,t,[e])&&(n[e]=t[e]);return n}function B(t,e){for(;null!==t;){var n=f(t,e);if(n){if(n.get)return R(n.get);if("function"==typeof n.value)return R(n.value)}t=p(t)}function r(t){return console.warn("fallback value for",t),null}return r}var U=m(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),j=m(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),F=m(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),z=m(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),V=m(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),G=m(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Y=m(["#text"]),H=m(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),W=m(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),K=m(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),q=m(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Q=g(/\{\{[\w\W]*|[\w\W]*\}\}/gm),X=g(/<%[\w\W]*|[\w\W]*%>/gm),Z=g(/\${[\w\W]*}/gm),J=g(/^data-[\-\w.\u00B7-\uFFFF]+$/),_=g(/^aria-[\-\w]+$/),$=g(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),tt=g(/^(?:\w+script|data):/i),et=g(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),nt=g(/^html$/i),rt=g(/^[a-z][.\w]*(-[.\w]+)+$/i),it=function(){return"undefined"==typeof window?null:window},st=function(e,n){if("object"!==t(e)||"function"!=typeof e.createPolicy)return null;var r=null,i="data-tt-policy-suffix";n.currentScript&&n.currentScript.hasAttribute(i)&&(r=n.currentScript.getAttribute(i));var s="dompurify"+(r?"#"+r:"");try{return e.createPolicy(s,{createHTML:function(t){return t},createScriptURL:function(t){return t}})}catch(t){return console.warn("TrustedTypes policy "+s+" could not be created."),null}};function ot(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:it(),n=function(t){return ot(t)};if(n.version="2.5.8",n.removed=[],!e||!e.document||9!==e.document.nodeType)return n.isSupported=!1,n;var r=e.document,s=e.document,o=e.DocumentFragment,a=e.HTMLTemplateElement,c=e.Node,u=e.Element,l=e.NodeFilter,h=e.NamedNodeMap,d=void 0===h?e.NamedNodeMap||e.MozNamedAttrMap:h,p=e.HTMLFormElement,f=e.DOMParser,g=e.trustedTypes,b=u.prototype,y=B(b,"cloneNode"),v=B(b,"nextSibling"),w=B(b,"childNodes"),R=B(b,"parentNode");if("function"==typeof a){var D=s.createElement("template");D.content&&D.content.ownerDocument&&(s=D.content.ownerDocument)}var at=st(g,r),ct=at?at.createHTML(""):"",ut=s,lt=ut.implementation,ht=ut.createNodeIterator,dt=ut.createDocumentFragment,pt=ut.getElementsByTagName,ft=r.importNode,mt={};try{mt=L(s).documentMode?s.documentMode:{}}catch(t){}var gt={};n.isSupported="function"==typeof R&&lt&&void 0!==lt.createHTMLDocument&&9!==mt;var bt,yt,vt=Q,wt=X,Tt=Z,Et=J,At=_,kt=tt,It=et,St=rt,xt=$,Ot=null,Mt=P({},[].concat(i(U),i(j),i(F),i(V),i(Y))),Nt=null,Ct=P({},[].concat(i(H),i(W),i(K),i(q))),Rt=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Dt=null,Pt=null,Lt=!0,Bt=!0,Ut=!1,jt=!0,Ft=!1,zt=!0,Vt=!1,Gt=!1,Yt=!1,Ht=!1,Wt=!1,Kt=!1,qt=!0,Qt=!1,Xt="user-content-",Zt=!0,Jt=!1,_t={},$t=null,te=P({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),ee=null,ne=P({},["audio","video","img","source","image","track"]),re=null,ie=P({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),se="http://www.w3.org/1998/Math/MathML",oe="http://www.w3.org/2000/svg",ae="http://www.w3.org/1999/xhtml",ce=ae,ue=!1,le=null,he=P({},[se,oe,ae],I),de=["application/xhtml+xml","text/html"],pe="text/html",fe=null,me=s.createElement("form"),ge=function(t){return t instanceof RegExp||t instanceof Function},be=function(e){fe&&fe===e||(e&&"object"===t(e)||(e={}),e=L(e),bt=bt=-1===de.indexOf(e.PARSER_MEDIA_TYPE)?pe:e.PARSER_MEDIA_TYPE,yt="application/xhtml+xml"===bt?I:k,Ot="ALLOWED_TAGS"in e?P({},e.ALLOWED_TAGS,yt):Mt,Nt="ALLOWED_ATTR"in e?P({},e.ALLOWED_ATTR,yt):Ct,le="ALLOWED_NAMESPACES"in e?P({},e.ALLOWED_NAMESPACES,I):he,re="ADD_URI_SAFE_ATTR"in e?P(L(ie),e.ADD_URI_SAFE_ATTR,yt):ie,ee="ADD_DATA_URI_TAGS"in e?P(L(ne),e.ADD_DATA_URI_TAGS,yt):ne,$t="FORBID_CONTENTS"in e?P({},e.FORBID_CONTENTS,yt):te,Dt="FORBID_TAGS"in e?P({},e.FORBID_TAGS,yt):{},Pt="FORBID_ATTR"in e?P({},e.FORBID_ATTR,yt):{},_t="USE_PROFILES"in e&&e.USE_PROFILES,Lt=!1!==e.ALLOW_ARIA_ATTR,Bt=!1!==e.ALLOW_DATA_ATTR,Ut=e.ALLOW_UNKNOWN_PROTOCOLS||!1,jt=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Ft=e.SAFE_FOR_TEMPLATES||!1,zt=!1!==e.SAFE_FOR_XML,Vt=e.WHOLE_DOCUMENT||!1,Ht=e.RETURN_DOM||!1,Wt=e.RETURN_DOM_FRAGMENT||!1,Kt=e.RETURN_TRUSTED_TYPE||!1,Yt=e.FORCE_BODY||!1,qt=!1!==e.SANITIZE_DOM,Qt=e.SANITIZE_NAMED_PROPS||!1,Zt=!1!==e.KEEP_CONTENT,Jt=e.IN_PLACE||!1,xt=e.ALLOWED_URI_REGEXP||xt,ce=e.NAMESPACE||ae,Rt=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ge(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Rt.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ge(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Rt.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Rt.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ft&&(Bt=!1),Wt&&(Ht=!0),_t&&(Ot=P({},i(Y)),Nt=[],!0===_t.html&&(P(Ot,U),P(Nt,H)),!0===_t.svg&&(P(Ot,j),P(Nt,W),P(Nt,q)),!0===_t.svgFilters&&(P(Ot,F),P(Nt,W),P(Nt,q)),!0===_t.mathMl&&(P(Ot,V),P(Nt,K),P(Nt,q))),e.ADD_TAGS&&(Ot===Mt&&(Ot=L(Ot)),P(Ot,e.ADD_TAGS,yt)),e.ADD_ATTR&&(Nt===Ct&&(Nt=L(Nt)),P(Nt,e.ADD_ATTR,yt)),e.ADD_URI_SAFE_ATTR&&P(re,e.ADD_URI_SAFE_ATTR,yt),e.FORBID_CONTENTS&&($t===te&&($t=L($t)),P($t,e.FORBID_CONTENTS,yt)),Zt&&(Ot["#text"]=!0),Vt&&P(Ot,["html","head","body"]),Ot.table&&(P(Ot,["tbody"]),delete Dt.tbody),m&&m(e),fe=e)},ye=P({},["mi","mo","mn","ms","mtext"]),ve=P({},["annotation-xml"]),we=P({},["title","style","font","a","script"]),Te=P({},j);P(Te,F),P(Te,z);var Ee=P({},V);P(Ee,G);var Ae=function(t){var e=R(t);e&&e.tagName||(e={namespaceURI:ce,tagName:"template"});var n=k(t.tagName),r=k(e.tagName);return!!le[t.namespaceURI]&&(t.namespaceURI===oe?e.namespaceURI===ae?"svg"===n:e.namespaceURI===se?"svg"===n&&("annotation-xml"===r||ye[r]):Boolean(Te[n]):t.namespaceURI===se?e.namespaceURI===ae?"math"===n:e.namespaceURI===oe?"math"===n&&ve[r]:Boolean(Ee[n]):t.namespaceURI===ae?!(e.namespaceURI===oe&&!ve[r])&&!(e.namespaceURI===se&&!ye[r])&&!Ee[n]&&(we[n]||!Te[n]):!("application/xhtml+xml"!==bt||!le[t.namespaceURI]))},ke=function(t){A(n.removed,{element:t});try{t.parentNode.removeChild(t)}catch(e){try{t.outerHTML=ct}catch(e){t.remove()}}},Ie=function(t,e){try{A(n.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){A(n.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t&&!Nt[t])if(Ht||Wt)try{ke(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},Se=function(t){var e,n;if(Yt)t="<remove></remove>"+t;else{var r=S(t,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===bt&&ce===ae&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");var i=at?at.createHTML(t):t;if(ce===ae)try{e=(new f).parseFromString(i,bt)}catch(t){}if(!e||!e.documentElement){e=lt.createDocument(ce,"template",null);try{e.documentElement.innerHTML=ue?ct:i}catch(t){}}var o=e.body||e.documentElement;return t&&n&&o.insertBefore(s.createTextNode(n),o.childNodes[0]||null),ce===ae?pt.call(e,Vt?"html":"body")[0]:Vt?e.documentElement:o},xe=function(t){return ht.call(t.ownerDocument||t,t,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null,!1)},Oe=function(t){return t instanceof p&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||!(t.attributes instanceof d)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes)},Me=function(e){return"object"===t(c)?e instanceof c:e&&"object"===t(e)&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Ne=function(t,e,r){gt[t]&&T(gt[t],(function(t){t.call(n,e,r,fe)}))},Ce=function(t){var e;if(Ne("beforeSanitizeElements",t,null),Oe(t))return ke(t),!0;if(N(/[\u0080-\uFFFF]/,t.nodeName))return ke(t),!0;var r=yt(t.nodeName);if(Ne("uponSanitizeElement",t,{tagName:r,allowedTags:Ot}),t.hasChildNodes()&&!Me(t.firstElementChild)&&(!Me(t.content)||!Me(t.content.firstElementChild))&&N(/<[/\w]/g,t.innerHTML)&&N(/<[/\w]/g,t.textContent))return ke(t),!0;if("select"===r&&N(/<template/i,t.innerHTML))return ke(t),!0;if(7===t.nodeType)return ke(t),!0;if(zt&&8===t.nodeType&&N(/<[/\w]/g,t.data))return ke(t),!0;if(!Ot[r]||Dt[r]){if(!Dt[r]&&De(r)){if(Rt.tagNameCheck instanceof RegExp&&N(Rt.tagNameCheck,r))return!1;if(Rt.tagNameCheck instanceof Function&&Rt.tagNameCheck(r))return!1}if(Zt&&!$t[r]){var i=R(t)||t.parentNode,s=w(t)||t.childNodes;if(s&&i)for(var o=s.length-1;o>=0;--o){var a=y(s[o],!0);a.__removalCount=(t.__removalCount||0)+1,i.insertBefore(a,v(t))}}return ke(t),!0}return t instanceof u&&!Ae(t)?(ke(t),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!N(/<\/no(script|embed|frames)/i,t.innerHTML)?(Ft&&3===t.nodeType&&(e=t.textContent,e=x(e,vt," "),e=x(e,wt," "),e=x(e,Tt," "),t.textContent!==e&&(A(n.removed,{element:t.cloneNode()}),t.textContent=e)),Ne("afterSanitizeElements",t,null),!1):(ke(t),!0)},Re=function(t,e,n){if(qt&&("id"===e||"name"===e)&&(n in s||n in me))return!1;if(Bt&&!Pt[e]&&N(Et,e));else if(Lt&&N(At,e));else if(!Nt[e]||Pt[e]){if(!(De(t)&&(Rt.tagNameCheck instanceof RegExp&&N(Rt.tagNameCheck,t)||Rt.tagNameCheck instanceof Function&&Rt.tagNameCheck(t))&&(Rt.attributeNameCheck instanceof RegExp&&N(Rt.attributeNameCheck,e)||Rt.attributeNameCheck instanceof Function&&Rt.attributeNameCheck(e))||"is"===e&&Rt.allowCustomizedBuiltInElements&&(Rt.tagNameCheck instanceof RegExp&&N(Rt.tagNameCheck,n)||Rt.tagNameCheck instanceof Function&&Rt.tagNameCheck(n))))return!1}else if(re[e]);else if(N(xt,x(n,It,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==O(n,"data:")||!ee[t])if(Ut&&!N(kt,x(n,It,"")));else if(n)return!1;return!0},De=function(t){return"annotation-xml"!==t&&S(t,St)},Pe=function(e){var r,i,s,o;Ne("beforeSanitizeAttributes",e,null);var a=e.attributes;if(a&&!Oe(e)){var c={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Nt};for(o=a.length;o--;){var u=r=a[o],l=u.name,h=u.namespaceURI;if(i="value"===l?r.value:M(r.value),s=yt(l),c.attrName=s,c.attrValue=i,c.keepAttr=!0,c.forceKeepAttr=void 0,Ne("uponSanitizeAttribute",e,c),i=c.attrValue,!c.forceKeepAttr&&(Ie(l,e),c.keepAttr))if(jt||!N(/\/>/i,i)){Ft&&(i=x(i,vt," "),i=x(i,wt," "),i=x(i,Tt," "));var d=yt(e.nodeName);if(Re(d,s,i))if(!Qt||"id"!==s&&"name"!==s||(Ie(l,e),i=Xt+i),zt&&N(/((--!?|])>)|<\/(style|title)/i,i))Ie(l,e);else{if(at&&"object"===t(g)&&"function"==typeof g.getAttributeType)if(h);else switch(g.getAttributeType(d,s)){case"TrustedHTML":i=at.createHTML(i);break;case"TrustedScriptURL":i=at.createScriptURL(i)}try{h?e.setAttributeNS(h,l,i):e.setAttribute(l,i),Oe(e)?ke(e):E(n.removed)}catch(t){}}}else Ie(l,e)}Ne("afterSanitizeAttributes",e,null)}},Le=function t(e){var n,r=xe(e);for(Ne("beforeSanitizeShadowDOM",e,null);n=r.nextNode();)Ne("uponSanitizeShadowNode",n,null),Ce(n),Pe(n),n.content instanceof o&&t(n.content);Ne("afterSanitizeShadowDOM",e,null)};return n.sanitize=function(i){var s,a,u,l,h,d=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((ue=!i)&&(i="\x3c!--\x3e"),"string"!=typeof i&&!Me(i)){if("function"!=typeof i.toString)throw C("toString is not a function");if("string"!=typeof(i=i.toString()))throw C("dirty is not a string, aborting")}if(!n.isSupported){if("object"===t(e.toStaticHTML)||"function"==typeof e.toStaticHTML){if("string"==typeof i)return e.toStaticHTML(i);if(Me(i))return e.toStaticHTML(i.outerHTML)}return i}if(Gt||be(d),n.removed=[],"string"==typeof i&&(Jt=!1),Jt){if(i.nodeName){var p=yt(i.nodeName);if(!Ot[p]||Dt[p])throw C("root node is forbidden and cannot be sanitized in-place")}}else if(i instanceof c)1===(a=(s=Se("\x3c!----\x3e")).ownerDocument.importNode(i,!0)).nodeType&&"BODY"===a.nodeName||"HTML"===a.nodeName?s=a:s.appendChild(a);else{if(!Ht&&!Ft&&!Vt&&-1===i.indexOf("<"))return at&&Kt?at.createHTML(i):i;if(!(s=Se(i)))return Ht?null:Kt?ct:""}s&&Yt&&ke(s.firstChild);for(var f=xe(Jt?i:s);u=f.nextNode();)3===u.nodeType&&u===l||(Ce(u),Pe(u),u.content instanceof o&&Le(u.content),l=u);if(l=null,Jt)return i;if(Ht){if(Wt)for(h=dt.call(s.ownerDocument);s.firstChild;)h.appendChild(s.firstChild);else h=s;return(Nt.shadowroot||Nt.shadowrootmod)&&(h=ft.call(r,h,!0)),h}var m=Vt?s.outerHTML:s.innerHTML;return Vt&&Ot["!doctype"]&&s.ownerDocument&&s.ownerDocument.doctype&&s.ownerDocument.doctype.name&&N(nt,s.ownerDocument.doctype.name)&&(m="<!DOCTYPE "+s.ownerDocument.doctype.name+">\n"+m),Ft&&(m=x(m,vt," "),m=x(m,wt," "),m=x(m,Tt," ")),at&&Kt?at.createHTML(m):m},n.setConfig=function(t){be(t),Gt=!0},n.clearConfig=function(){fe=null,Gt=!1},n.isValidAttribute=function(t,e,n){fe||be({});var r=yt(t),i=yt(e);return Re(r,i,n)},n.addHook=function(t,e){"function"==typeof e&&(gt[t]=gt[t]||[],A(gt[t],e))},n.removeHook=function(t){if(gt[t])return E(gt[t])},n.removeHooks=function(t){gt[t]&&(gt[t]=[])},n.removeAllHooks=function(){gt={}},n}return ot()}()},function(t,e){class n{static get svg(){return"http://www.w3.org/2000/svg"}static get xmlns(){return"http://www.w3.org/2000/xmlns"}static get xlink(){return"http://www.w3.org/1999/xlink"}static attributeNamespace(){return{href:n.xlink,xlink:n.xmlns,xmlns:`${n.xmlns}/`,"xmlns:xlink":`${n.xmlns}/`}}static create(t,e,r){return n.set(document.createElementNS(n.svg,t),e,r)}static get(t,e){const r=n.attributeNamespace[e],i=r?t.getAttributeNS(r,e):t.getAttribute(e);return"null"===i?null:i}static set(t,e,r){for(const i in e){let s=e[i];const o=n.attributeNamespace[i];"number"==typeof s&&r&&(s=r.number(s)),o?t.setAttributeNS(o,i,s):t.setAttribute(i,s)}return t}}t.exports=n},function(t,e){t.exports=class{constructor(t,e,n){this.audioEngine=t,this.audioPlayer=e,this.lastEffect=n,this.value=this.DEFAULT_VALUE,this.initialized=!1,this.inputNode=null,this.outputNode=null,this.target=null}get name(){throw new Error("".concat(this.constructor.name,".name is not implemented"))}get DEFAULT_VALUE(){return 0}get _isPatch(){return this.initialized&&(this.value!==this.DEFAULT_VALUE||null===this.audioPlayer)}getInputNode(){return this._isPatch?this.inputNode:this.target.getInputNode()}initialize(){throw new Error("".concat(this.constructor.name,".initialize is not implemented."))}_set(){throw new Error("".concat(this.constructor.name,"._set is not implemented."))}set(t){this.initialized||this.initialize();const e=this._isPatch;e&&(this._lastPatch=this.audioEngine.currentTime),t!==this.value&&this._set(t),this._isPatch!==e&&null!==this.target&&this.connect(this.target)}update(){}clear(){this.set(this.DEFAULT_VALUE)}connect(t){if(null===t)throw new Error("target may not be null");const e=t=>{if(t)return t===this||e(t.target)};if(e(t))throw new Error("Effect cannot connect to itself");this.target=t,null!==this.outputNode&&this.outputNode.disconnect(),(this._isPatch||this._lastPatch+this.audioEngine.DECAY_DURATION<this.audioEngine.currentTime)&&this.outputNode.connect(t.getInputNode()),null===this.lastEffect?null!==this.audioPlayer&&this.audioPlayer.connect(this):this.lastEffect.connect(this)}dispose(){this.inputNode=null,this.outputNode=null,this.target=null,this.initialized=!1}}},function(t,e,n){"use strict";var r=n(93),i=n.n(r),s=n(94),o=n.n(s),a=n(95),c=i()((function(t){return t[1]})),u=o()(a.a);c.push([t.i,'.sc-root {\n  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;\n  width: 100%;\n  height: 100%;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  position: relative;\n  --sc-accent-color: #ff4c4c;\n  --sc-accent-color-transparent: #ff4c4c59;\n}\n.sc-layers {\n  position: relative;\n}\n.sc-layers > * {\n  position: absolute;\n}\n.sc-scaled-overlays-outer {\n  overflow: hidden;\n  width: 100%;\n  height: 100%;\n  pointer-events: none;\n}\n.sc-scaled-overlays-inner {\n  transform-origin: top left;\n}\n.sc-root * {\n  box-sizing: border-box;\n}\n.sc-canvas {\n  width: 100%;\n  height: 100%;\n}\n\n.sc-question-root {\n  bottom: 0;\n  width: 100%;\n  color: black;\n  pointer-events: all;\n}\n.sc-question-inner {\n  margin: 0.5rem;\n  border: 1px solid hsla(0, 0%, 0%, 0.15);\n  border-radius: 0.5rem;\n  border-width: 2px;\n  padding: 1rem;\n  background: white;\n}\n.sc-question-text {\n  font-size: 12px;\n  padding-bottom: 8px;\n  font-weight: bold;\n}\n.sc-question-input-outer {\n  position: relative;\n}\n.sc-question-input {\n  width: 100%;\n  height: 2rem;\n  padding: 0 12px;\n  font-size: 10px;\n  border-width: 1px;\n  border-style: solid;\n  border-color: hsla(0, 0%, 0%, 0.15);\n  border-radius: 2rem;\n  outline: none;\n  transition: 0.25s ease-out;\n  box-shadow: none;\n  overflow: hidden;\n  text-overflow: ellipsis;\n  color: inherit;\n}\n.sc-question-input:focus {\n  border-color: var(--sc-accent-color);\n  box-shadow: 0px 0px 0px 3px var(--sc-accent-color-transparent);\n}\n.sc-question-input:hover {\n  border-color: var(--sc-accent-color);\n}\n.sc-question-submit-button {\n  top: 4px;\n  right: 4px;\n  width: 24px;\n  height: 24px;\n  position: absolute;\n  outline: none;\n  border: none;\n  padding: 2px;\n  margin: 0;\n  border-radius: 100%;\n  background: none;\n  cursor: pointer;\n  color: white;\n  background-color: var(--sc-accent-color);\n  background-image: url('+u+');\n  overflow: hidden;\n}\n.sc-question-submit-button:focus {\n  outline: 2px solid black;\n}\n.sc-question-submit-button-image {\n  width: 100%;\n  height: 100%;\n}\n\n.sc-monitor-overlay {\n\n}\n.sc-monitor-root {\n  position: absolute;\n  top: 0;\n  left: 0;\n  background: hsla(215, 100%, 95%, 1);\n  color: #575e75;\n  border: 1px solid hsla(0, 0%, 0%, 0.15);\n  border-radius: 4px;\n  font-size: 12px;\n  overflow: hidden;\n  user-select: none;\n  -webkit-user-select: none;\n  display: flex;\n  flex-direction: column;\n  pointer-events: all;\n}\n.sc-monitor-inner {\n  display: flex;\n  flex-direction: column;\n  padding: 3px;\n}\n.sc-monitor-row {\n  display: flex;\n  flex-direction: row;\n}\n.sc-monitor-label {\n  font-weight: bold;\n  text-align: center;\n  margin: 0 5px;\n  white-space: nowrap;\n}\n.sc-monitor-slider {\n  margin: 0;\n  width: 100%;\n}\n.sc-monitor-value {\n  min-width: 40px;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  text-align: center;\n  color: white;\n  margin: 0 5px;\n  border-radius: 4px;\n  padding: 0 2px;\n  white-space: pre-wrap;\n  background-color: #0fbd8c;\n}\n.sc-monitor-root[data-opcode^="motion_"] .sc-monitor-value-color {\n  background-color: #4c97ff;\n}\n.sc-monitor-root[data-opcode^="sensing_"] .sc-monitor-value-color {\n  background-color: #5cb1d6;\n}\n.sc-monitor-root[data-opcode^="data_"] .sc-monitor-value-color {\n  background-color: #ff8c1a;\n}\n.sc-monitor-root[data-opcode^="looks_"] .sc-monitor-value-color {\n  background-color: #9966ff;\n}\n.sc-monitor-root[data-opcode^="sound_"] .sc-monitor-value-color {\n  background-color: #cf63cf;\n}\n.sc-monitor-large-value {\n  min-height: 1.4rem;\n  min-width: 3rem;\n  padding: 0.1rem 0.25rem;\n  text-align: center;\n  color: white;\n  font-size: 1rem;\n  white-space: pre-wrap;\n}\n\n.sc-monitor-list-label {\n  background-color: white;\n  text-align: center;\n  font-weight: bold;\n  border-bottom: 1px solid hsla(0, 0%, 0%, 0.15);\n  padding: 3px;\n}\n.sc-monitor-list-footer {\n  display: flex;\n  background-color: white;\n  text-align: center;\n  font-weight: bold;\n  padding: 3px;\n}\n.sc-monitor-list-footer-text {\n  text-align: center;\n  flex-grow: 1;\n}\n.sc-monitor-row-delete, .sc-monitor-list-add {\n  font-weight: bold;\n  background: none;\n  border: none;\n  outline: none;\n  font-family: inherit;\n  color: inherit;\n  cursor: pointer;\n  margin: 0;\n  padding: 0;\n}\n.sc-monitor-rows-outer {\n  flex-grow: 1;\n}\n.sc-monitor-rows-inner {\n  height: 100%;\n  overflow-y: auto;\n  overflow-x: hidden;\n  position: relative;\n}\n.sc-monitor-rows-endpoint {\n  position: absolute;\n  top: 0;\n  left: 0;\n  width: 1px;\n  height: 1px;\n  pointer-events: none;\n}\n\n.sc-monitor-row-root {\n  position: absolute;\n  top: 0;\n  left: 0;\n  display: flex;\n  justify-content: space-around;\n  align-items: center;\n  padding: 2px;\n  width: 100%;\n}\n.sc-monitor-row-index {\n  font-weight: bold;\n  color: hsla(225, 15%, 40%, 1);\n  margin: 0 3px;\n}\n.sc-monitor-row-value-outer {\n  display: flex;\n  align-items: center;\n  min-width: 40px;\n  height: 22px;\n  border: 1px solid hsla(0, 0%, 0%, 0.15);\n  background-color: #fc662c;\n  color: white;\n  margin: 0 3px;\n  border-radius: calc(0.5rem / 2);\n  flex-grow: 1;\n}\n.sc-monitor-row-value-editing .sc-monitor-row-value-outer {\n  background-color: #e25c28;\n}\n.sc-monitor-row-value-inner {\n  padding: 3px 5px;\n  width: 100%;\n  color: inherit;\n  background: none;\n  border: none;\n  font: inherit;\n  outline: none;\n  overflow: hidden;\n  text-overflow: ellipsis;\n  user-select: text;\n  -webkit-user-select: text;\n  white-space: pre;\n}\n.sc-monitor-row-value-editing .sc-monitor-row-value-inner {\n  padding-right: 0;\n}\n.sc-monitor-row-delete {\n  display: none;\n  font-size: 150%;\n  padding: 0 2px;\n}\n.sc-monitor-row-value-editing .sc-monitor-row-delete {\n  display: block;\n}\n.sc-monitor-empty {\n  text-align: center;\n  padding: 5px;\n}\n\n.sc-controls-bar {\n  transform: translateY(-100%);\n  display: flex;\n  width: 100%;\n  justify-content: space-between;\n  flex-wrap: nowrap;\n}\n.sc-controls-bar > * {\n  display: flex;\n  align-items: center;\n  flex-wrap: nowrap;\n}\n\n.sc-context-menu {\n  position: absolute;\n  color: black;\n  box-shadow: 0px 0px 5px 1px hsla(0, 0%, 0%, 0.25);\n  min-width: 130px;\n  opacity: 0;\n  transition: .2s opacity;\n}\n.sc-context-menu-item {\n  display: block;\n  width: 100%;\n  background-color: white;\n  border: none;\n  border-radius: 0;\n  cursor: pointer;\n  text-align: left;\n  font-family: inherit;\n  font-size: 0.85em;\n  padding: 8px 12px;\n  margin: 0;\n  transition: .1s background-color, .1s color;\n}\n.sc-context-menu-item:focus {\n  outline: 2px solid black;\n}\n.sc-context-menu-item:hover,\n.sc-context-menu-item:active {\n  color: white;\n  background-color: var(--sc-accent-color);\n}\n.sc-context-menu-item:first-child {\n  border-radius: 4px 4px 0 0;\n}\n.sc-context-menu-item:last-child {\n  border-radius: 0 0 4px 4px;\n}\n\n.sc-dropping {\n  background-color: var(--sc-accent-color-transparent);\n}\n',""]),c.locals={root:"sc-root",layers:"sc-layers","scaled-overlays-outer":"sc-scaled-overlays-outer",scaledOverlaysOuter:"sc-scaled-overlays-outer","scaled-overlays-inner":"sc-scaled-overlays-inner",scaledOverlaysInner:"sc-scaled-overlays-inner",canvas:"sc-canvas","question-root":"sc-question-root",questionRoot:"sc-question-root","question-inner":"sc-question-inner",questionInner:"sc-question-inner","question-text":"sc-question-text",questionText:"sc-question-text","question-input-outer":"sc-question-input-outer",questionInputOuter:"sc-question-input-outer","question-input":"sc-question-input",questionInput:"sc-question-input","question-submit-button":"sc-question-submit-button",questionSubmitButton:"sc-question-submit-button","question-submit-button-image":"sc-question-submit-button-image",questionSubmitButtonImage:"sc-question-submit-button-image","monitor-overlay":"sc-monitor-overlay",monitorOverlay:"sc-monitor-overlay","monitor-root":"sc-monitor-root",monitorRoot:"sc-monitor-root","monitor-inner":"sc-monitor-inner",monitorInner:"sc-monitor-inner","monitor-row":"sc-monitor-row",monitorRow:"sc-monitor-row","monitor-label":"sc-monitor-label",monitorLabel:"sc-monitor-label","monitor-slider":"sc-monitor-slider",monitorSlider:"sc-monitor-slider","monitor-value":"sc-monitor-value",monitorValue:"sc-monitor-value","monitor-value-color":"sc-monitor-value-color",monitorValueColor:"sc-monitor-value-color","monitor-large-value":"sc-monitor-large-value",monitorLargeValue:"sc-monitor-large-value","monitor-list-label":"sc-monitor-list-label",monitorListLabel:"sc-monitor-list-label","monitor-list-footer":"sc-monitor-list-footer",monitorListFooter:"sc-monitor-list-footer","monitor-list-footer-text":"sc-monitor-list-footer-text",monitorListFooterText:"sc-monitor-list-footer-text","monitor-row-delete":"sc-monitor-row-delete",monitorRowDelete:"sc-monitor-row-delete","monitor-list-add":"sc-monitor-list-add",monitorListAdd:"sc-monitor-list-add","monitor-rows-outer":"sc-monitor-rows-outer",monitorRowsOuter:"sc-monitor-rows-outer","monitor-rows-inner":"sc-monitor-rows-inner",monitorRowsInner:"sc-monitor-rows-inner","monitor-rows-endpoint":"sc-monitor-rows-endpoint",monitorRowsEndpoint:"sc-monitor-rows-endpoint","monitor-row-root":"sc-monitor-row-root",monitorRowRoot:"sc-monitor-row-root","monitor-row-index":"sc-monitor-row-index",monitorRowIndex:"sc-monitor-row-index","monitor-row-value-outer":"sc-monitor-row-value-outer",monitorRowValueOuter:"sc-monitor-row-value-outer","monitor-row-value-editing":"sc-monitor-row-value-editing",monitorRowValueEditing:"sc-monitor-row-value-editing","monitor-row-value-inner":"sc-monitor-row-value-inner",monitorRowValueInner:"sc-monitor-row-value-inner","monitor-empty":"sc-monitor-empty",monitorEmpty:"sc-monitor-empty","controls-bar":"sc-controls-bar",controlsBar:"sc-controls-bar","context-menu":"sc-context-menu",contextMenu:"sc-context-menu","context-menu-item":"sc-context-menu-item",contextMenuItem:"sc-context-menu-item",dropping:"sc-dropping"},e.a=c},function(t,e,n){const r=n(102);t.exports=r},function(t,e,n){const r=n(104),i=n(0);t.exports=new class extends r{constructor(){super(),this.services={},this.workerClass="undefined"==typeof Worker?null:Worker,this.workers=[]}callSync(t,e){const{provider:n,isRemote:r}=this._getServiceProvider(t);if(n){if(r)throw new Error("Cannot use 'callSync' on remote provider for service ".concat(t,"."));for(var i=arguments.length,s=new Array(i>2?i-2:0),o=2;o<i;o++)s[o-2]=arguments[o];return n[e].apply(n,s)}throw new Error("Provider not found for service: ".concat(t))}setServiceSync(t,e){Object.prototype.hasOwnProperty.call(this.services,t)&&i.warn("Central dispatch replacing existing service provider for ".concat(t)),this.services[t]=e}setService(t,e){try{return this.setServiceSync(t,e),Promise.resolve()}catch(t){return Promise.reject(t)}}addWorker(t){-1===this.workers.indexOf(t)?(this.workers.push(t),t.onmessage=this._onMessage.bind(this,t),this._remoteCall(t,"dispatch","handshake").catch((t=>{i.error("Could not handshake with worker: ".concat(t))}))):i.warn("Central dispatch ignoring attempt to add duplicate worker")}_getServiceProvider(t){const e=this.services[t];return e&&{provider:e,isRemote:Boolean(this.workerClass&&e instanceof this.workerClass||e.isRemote)}}_onDispatchMessage(t,e){let n;if("setService"===e.method)n=this.setService(e.args[0],t);else i.error("Central dispatch received message for unknown method: ".concat(e.method));return n}}},function(t,e,n){const r=n(5);t.exports=function(t,e,n){return t&&t.id&&t.default?r(t,e,n):t}},function(t,e){var n="long",r="short",i="narrow",s="numeric",o="2-digit";t.exports={number:{decimal:{style:"decimal"},integer:{style:"decimal",maximumFractionDigits:0},currency:{style:"currency",currency:"USD"},percent:{style:"percent"},default:{style:"decimal"}},date:{short:{month:s,day:s,year:o},medium:{month:r,day:s,year:s},long:{month:n,day:s,year:s},full:{month:n,day:s,year:s,weekday:n},default:{month:r,day:s,year:s}},time:{short:{hour:s,minute:s},medium:{hour:s,minute:s,second:s},long:{hour:s,minute:s,second:s,timeZoneName:r},full:{hour:s,minute:s,second:s,timeZoneName:r},default:{hour:s,minute:s,second:s}},duration:{default:{hours:{minimumIntegerDigits:1,maximumFractionDigits:0},minutes:{minimumIntegerDigits:2,maximumFractionDigits:0},seconds:{minimumIntegerDigits:2,maximumFractionDigits:3}}},parseNumberPattern:function(t){if(t){var e={},n=t.match(/\b[A-Z]{3}\b/i),r=t.replace(/[^¤]/g,"").length;if(!r&&n&&(r=1),r?(e.style="currency",e.currencyDisplay=1===r?"symbol":2===r?"code":"name",e.currency=n?n[0].toUpperCase():"USD"):t.indexOf("%")>=0&&(e.style="percent"),!/[@#0]/.test(t))return e.style?e:void 0;if(e.useGrouping=t.indexOf(",")>=0,/E\+?[@#0]+/i.test(t)||t.indexOf("@")>=0){var i=t.replace(/E\+?[@#0]+|[^@#0]/gi,"");e.minimumSignificantDigits=Math.min(Math.max(i.replace(/[^@0]/g,"").length,1),21),e.maximumSignificantDigits=Math.min(Math.max(i.length,1),21)}else{for(var s=t.replace(/[^#0.]/g,"").split("."),o=s[0],a=o.length-1;"0"===o[a];)--a;e.minimumIntegerDigits=Math.min(Math.max(o.length-1-a,1),21);var c=s[1]||"";for(a=0;"0"===c[a];)++a;for(e.minimumFractionDigits=Math.min(Math.max(a,0),20);"#"===c[a];)++a;e.maximumFractionDigits=Math.min(Math.max(a,0),20)}return e}},parseDatePattern:function(t){if(t){for(var e={},a=0;a<t.length;){for(var c=t[a],u=1;t[++a]===c;)++u;switch(c){case"G":e.era=5===u?i:4===u?n:r;break;case"y":case"Y":e.year=2===u?o:s;break;case"M":case"L":u=Math.min(Math.max(u-1,0),4),e.month=[s,o,r,n,i][u];break;case"E":case"e":case"c":e.weekday=5===u?i:4===u?n:r;break;case"d":case"D":e.day=2===u?o:s;break;case"h":case"K":e.hour12=!0,e.hour=2===u?o:s;break;case"H":case"k":e.hour12=!1,e.hour=2===u?o:s;break;case"m":e.minute=2===u?o:s;break;case"s":case"S":e.second=2===u?o:s;break;case"z":case"Z":case"v":case"V":e.timeZoneName=1===u?r:n}}return Object.keys(e).length?e:void 0}}}},function(t,e){t.exports=function(t,e){if("string"==typeof t&&e[t])return t;for(var n=[].concat(t||[]),r=0,i=n.length;r<i;++r)for(var s=n[r].split("-");s.length;){var o=s.join("-");if(e[o])return o;s.pop()}}},function(t,e,n){"use strict";var r="zero",i="one",s="two",o="few",a="many",c="other",u=[function(t){return 1===+t?i:c},function(t){var e=+t;return 0<=e&&e<=1?i:c},function(t){return 0===Math.floor(Math.abs(+t))||1===+t?i:c},function(t){var e=+t;return 0===e?r:1===e?i:2===e?s:3<=e%100&&e%100<=10?o:11<=e%100&&e%100<=99?a:c},function(t){var e=Math.floor(Math.abs(+t)),n=(t+".").split(".")[1].length;return 1===e&&0===n?i:c},function(t){var e=+t;return e%10==1&&e%100!=11?i:2<=e%10&&e%10<=4&&(e%100<12||14<e%100)?o:e%10==0||5<=e%10&&e%10<=9||11<=e%100&&e%100<=14?a:c},function(t){var e=+t;return e%10==1&&e%100!=11&&e%100!=71&&e%100!=91?i:e%10==2&&e%100!=12&&e%100!=72&&e%100!=92?s:(3<=e%10&&e%10<=4||e%10==9)&&(e%100<10||19<e%100)&&(e%100<70||79<e%100)&&(e%100<90||99<e%100)?o:0!==e&&e%1e6==0?a:c},function(t){var e=Math.floor(Math.abs(+t)),n=(t+".").split(".")[1].length,r=+(t+".").split(".")[1];return 0===n&&e%10==1&&e%100!=11||r%10==1&&r%100!=11?i:0===n&&2<=e%10&&e%10<=4&&(e%100<12||14<e%100)||2<=r%10&&r%10<=4&&(r%100<12||14<r%100)?o:c},function(t){var e=Math.floor(Math.abs(+t)),n=(t+".").split(".")[1].length;return 1===e&&0===n?i:2<=e&&e<=4&&0===n?o:0!==n?a:c},function(t){var e=+t;return 0===e?r:1===e?i:2===e?s:3===e?o:6===e?a:c},function(t){var e=Math.floor(Math.abs(+t)),n=+(""+t).replace(/^[^.]*.?|0+$/g,"");return 1===+t||0!==n&&(0===e||1===e)?i:c},function(t){var e=Math.floor(Math.abs(+t)),n=(t+".").split(".")[1].length,r=+(t+".").split(".")[1];return 0===n&&e%100==1||r%100==1?i:0===n&&e%100==2||r%100==2?s:0===n&&3<=e%100&&e%100<=4||3<=r%100&&r%100<=4?o:c},function(t){var e=Math.floor(Math.abs(+t));return 0===e||1===e?i:c},function(t){var e=Math.floor(Math.abs(+t)),n=(t+".").split(".")[1].length,r=+(t+".").split(".")[1];return 0===n&&(1===e||2===e||3===e)||0===n&&e%10!=4&&e%10!=6&&e%10!=9||0!==n&&r%10!=4&&r%10!=6&&r%10!=9?i:c},function(t){var e=+t;return 1===e?i:2===e?s:3<=e&&e<=6?o:7<=e&&e<=10?a:c},function(t){var e=+t;return 1===e||11===e?i:2===e||12===e?s:3<=e&&e<=10||13<=e&&e<=19?o:c},function(t){var e=Math.floor(Math.abs(+t)),n=(t+".").split(".")[1].length;return 0===n&&e%10==1?i:0===n&&e%10==2?s:0!==n||e%100!=0&&e%100!=20&&e%100!=40&&e%100!=60&&e%100!=80?0!==n?a:c:o},function(t){var e=Math.floor(Math.abs(+t)),n=(t+".").split(".")[1].length,r=+t;return 1===e&&0===n?i:2===e&&0===n?s:0===n&&(r<0||10<r)&&r%10==0?a:c},function(t){var e=Math.floor(Math.abs(+t)),n=+(""+t).replace(/^[^.]*.?|0+$/g,"");return 0===n&&e%10==1&&e%100!=11||0!==n?i:c},function(t){var e=+t;return 1===e?i:2===e?s:c},function(t){var e=+t;return 0===e?r:1===e?i:c},function(t){var e=Math.floor(Math.abs(+t)),n=+t;return 0===n?r:0!==e&&1!==e||0===n?c:i},function(t){var e=+(t+".").split(".")[1],n=+t;return n%10==1&&(n%100<11||19<n%100)?i:2<=n%10&&n%10<=9&&(n%100<11||19<n%100)?o:0!==e?a:c},function(t){var e=(t+".").split(".")[1].length,n=+(t+".").split(".")[1],s=+t;return s%10==0||11<=s%100&&s%100<=19||2===e&&11<=n%100&&n%100<=19?r:s%10==1&&s%100!=11||2===e&&n%10==1&&n%100!=11||2!==e&&n%10==1?i:c},function(t){var e=Math.floor(Math.abs(+t)),n=(t+".").split(".")[1].length,r=+(t+".").split(".")[1];return 0===n&&e%10==1&&e%100!=11||r%10==1&&r%100!=11?i:c},function(t){var e=Math.floor(Math.abs(+t)),n=(t+".").split(".")[1].length,r=+t;return 1===e&&0===n?i:0!==n||0===r||1!==r&&1<=r%100&&r%100<=19?o:c},function(t){var e=+t;return 1===e?i:0===e||2<=e%100&&e%100<=10?o:11<=e%100&&e%100<=19?a:c},function(t){var e=Math.floor(Math.abs(+t)),n=(t+".").split(".")[1].length;return 1===e&&0===n?i:0===n&&2<=e%10&&e%10<=4&&(e%100<12||14<e%100)?o:0===n&&1!==e&&0<=e%10&&e%10<=1||0===n&&5<=e%10&&e%10<=9||0===n&&12<=e%100&&e%100<=14?a:c},function(t){var e=Math.floor(Math.abs(+t));return 0<=e&&e<=1?i:c},function(t){var e=Math.floor(Math.abs(+t)),n=(t+".").split(".")[1].length;return 0===n&&e%10==1&&e%100!=11?i:0===n&&2<=e%10&&e%10<=4&&(e%100<12||14<e%100)?o:0===n&&e%10==0||0===n&&5<=e%10&&e%10<=9||0===n&&11<=e%100&&e%100<=14?a:c},function(t){var e=+t;return 0===Math.floor(Math.abs(+t))||1===e?i:2<=e&&e<=10?o:c},function(t){var e=Math.floor(Math.abs(+t)),n=+(t+".").split(".")[1],r=+t;return 0===r||1===r||0===e&&1===n?i:c},function(t){var e=Math.floor(Math.abs(+t)),n=(t+".").split(".")[1].length;return 0===n&&e%100==1?i:0===n&&e%100==2?s:0===n&&3<=e%100&&e%100<=4||0!==n?o:c},function(t){var e=+t;return 0<=e&&e<=1||11<=e&&e<=99?i:c},function(t){var e=+t;return 1===e||5===e||7===e||8===e||9===e||10===e?i:2===e||3===e?s:4===e?o:6===e?a:c},function(t){var e=Math.floor(Math.abs(+t));return e%10==1||e%10==2||e%10==5||e%10==7||e%10==8||e%100==20||e%100==50||e%100==70||e%100==80?i:e%10==3||e%10==4||e%1e3==100||e%1e3==200||e%1e3==300||e%1e3==400||e%1e3==500||e%1e3==600||e%1e3==700||e%1e3==800||e%1e3==900?o:0===e||e%10==6||e%100==40||e%100==60||e%100==90?a:c},function(t){var e=+t;return e%10!=2&&e%10!=3||e%100==12||e%100==13?c:o},function(t){var e=+t;return 1===e||3===e?i:2===e?s:4===e?o:c},function(t){var e=+t;return 0===e||7===e||8===e||9===e?r:1===e?i:2===e?s:3===e||4===e?o:5===e||6===e?a:c},function(t){var e=+t;return e%10==1&&e%100!=11?i:e%10==2&&e%100!=12?s:e%10==3&&e%100!=13?o:c},function(t){var e=+t;return 1===e||11===e?i:2===e||12===e?s:3===e||13===e?o:c},function(t){var e=+t;return 1===e?i:2===e||3===e?s:4===e?o:6===e?a:c},function(t){var e=+t;return 1===e||5===e?i:c},function(t){var e=+t;return 11===e||8===e||80===e||800===e?a:c},function(t){var e=Math.floor(Math.abs(+t));return 1===e?i:0===e||2<=e%100&&e%100<=20||e%100==40||e%100==60||e%100==80?a:c},function(t){var e=+t;return e%10==6||e%10==9||e%10==0&&0!==e?a:c},function(t){var e=Math.floor(Math.abs(+t));return e%10==1&&e%100!=11?i:e%10==2&&e%100!=12?s:e%10!=7&&e%10!=8||e%100==17||e%100==18?c:a},function(t){var e=+t;return 1===e?i:2===e||3===e?s:4===e?o:c},function(t){var e=+t;return 1<=e&&e<=4?i:c},function(t){var e=+t;return 1===e||5===e||7<=e&&e<=9?i:2===e||3===e?s:4===e?o:6===e?a:c},function(t){var e=+t;return 1===e?i:e%10==4&&e%100!=14?a:c},function(t){var e=+t;return e%10!=1&&e%10!=2||e%100==11||e%100==12?c:i},function(t){var e=+t;return e%10==6||e%10==9||10===e?o:c},function(t){var e=+t;return e%10==3&&e%100!=13?o:c}];t.exports={af:{cardinal:u[0]},ak:{cardinal:u[1]},am:{cardinal:u[2]},ar:{cardinal:u[3]},ars:{cardinal:u[3]},as:{cardinal:u[2],ordinal:u[34]},asa:{cardinal:u[0]},ast:{cardinal:u[4]},az:{cardinal:u[0],ordinal:u[35]},be:{cardinal:u[5],ordinal:u[36]},bem:{cardinal:u[0]},bez:{cardinal:u[0]},bg:{cardinal:u[0]},bh:{cardinal:u[1]},bn:{cardinal:u[2],ordinal:u[34]},br:{cardinal:u[6]},brx:{cardinal:u[0]},bs:{cardinal:u[7]},ca:{cardinal:u[4],ordinal:u[37]},ce:{cardinal:u[0]},cgg:{cardinal:u[0]},chr:{cardinal:u[0]},ckb:{cardinal:u[0]},cs:{cardinal:u[8]},cy:{cardinal:u[9],ordinal:u[38]},da:{cardinal:u[10]},de:{cardinal:u[4]},dsb:{cardinal:u[11]},dv:{cardinal:u[0]},ee:{cardinal:u[0]},el:{cardinal:u[0]},en:{cardinal:u[4],ordinal:u[39]},eo:{cardinal:u[0]},es:{cardinal:u[0]},et:{cardinal:u[4]},eu:{cardinal:u[0]},fa:{cardinal:u[2]},ff:{cardinal:u[12]},fi:{cardinal:u[4]},fil:{cardinal:u[13],ordinal:u[0]},fo:{cardinal:u[0]},fr:{cardinal:u[12],ordinal:u[0]},fur:{cardinal:u[0]},fy:{cardinal:u[4]},ga:{cardinal:u[14],ordinal:u[0]},gd:{cardinal:u[15],ordinal:u[40]},gl:{cardinal:u[4]},gsw:{cardinal:u[0]},gu:{cardinal:u[2],ordinal:u[41]},guw:{cardinal:u[1]},gv:{cardinal:u[16]},ha:{cardinal:u[0]},haw:{cardinal:u[0]},he:{cardinal:u[17]},hi:{cardinal:u[2],ordinal:u[41]},hr:{cardinal:u[7]},hsb:{cardinal:u[11]},hu:{cardinal:u[0],ordinal:u[42]},hy:{cardinal:u[12],ordinal:u[0]},ia:{cardinal:u[4]},io:{cardinal:u[4]},is:{cardinal:u[18]},it:{cardinal:u[4],ordinal:u[43]},iu:{cardinal:u[19]},iw:{cardinal:u[17]},jgo:{cardinal:u[0]},ji:{cardinal:u[4]},jmc:{cardinal:u[0]},ka:{cardinal:u[0],ordinal:u[44]},kab:{cardinal:u[12]},kaj:{cardinal:u[0]},kcg:{cardinal:u[0]},kk:{cardinal:u[0],ordinal:u[45]},kkj:{cardinal:u[0]},kl:{cardinal:u[0]},kn:{cardinal:u[2]},ks:{cardinal:u[0]},ksb:{cardinal:u[0]},ksh:{cardinal:u[20]},ku:{cardinal:u[0]},kw:{cardinal:u[19]},ky:{cardinal:u[0]},lag:{cardinal:u[21]},lb:{cardinal:u[0]},lg:{cardinal:u[0]},ln:{cardinal:u[1]},lt:{cardinal:u[22]},lv:{cardinal:u[23]},mas:{cardinal:u[0]},mg:{cardinal:u[1]},mgo:{cardinal:u[0]},mk:{cardinal:u[24],ordinal:u[46]},ml:{cardinal:u[0]},mn:{cardinal:u[0]},mo:{cardinal:u[25],ordinal:u[0]},mr:{cardinal:u[2],ordinal:u[47]},mt:{cardinal:u[26]},nah:{cardinal:u[0]},naq:{cardinal:u[19]},nb:{cardinal:u[0]},nd:{cardinal:u[0]},ne:{cardinal:u[0],ordinal:u[48]},nl:{cardinal:u[4]},nn:{cardinal:u[0]},nnh:{cardinal:u[0]},no:{cardinal:u[0]},nr:{cardinal:u[0]},nso:{cardinal:u[1]},ny:{cardinal:u[0]},nyn:{cardinal:u[0]},om:{cardinal:u[0]},or:{cardinal:u[0],ordinal:u[49]},os:{cardinal:u[0]},pa:{cardinal:u[1]},pap:{cardinal:u[0]},pl:{cardinal:u[27]},prg:{cardinal:u[23]},ps:{cardinal:u[0]},pt:{cardinal:u[28]},"pt-PT":{cardinal:u[4]},rm:{cardinal:u[0]},ro:{cardinal:u[25],ordinal:u[0]},rof:{cardinal:u[0]},ru:{cardinal:u[29]},rwk:{cardinal:u[0]},saq:{cardinal:u[0]},sc:{cardinal:u[4],ordinal:u[43]},scn:{cardinal:u[4],ordinal:u[43]},sd:{cardinal:u[0]},sdh:{cardinal:u[0]},se:{cardinal:u[19]},seh:{cardinal:u[0]},sh:{cardinal:u[7]},shi:{cardinal:u[30]},si:{cardinal:u[31]},sk:{cardinal:u[8]},sl:{cardinal:u[32]},sma:{cardinal:u[19]},smi:{cardinal:u[19]},smj:{cardinal:u[19]},smn:{cardinal:u[19]},sms:{cardinal:u[19]},sn:{cardinal:u[0]},so:{cardinal:u[0]},sq:{cardinal:u[0],ordinal:u[50]},sr:{cardinal:u[7]},ss:{cardinal:u[0]},ssy:{cardinal:u[0]},st:{cardinal:u[0]},sv:{cardinal:u[4],ordinal:u[51]},sw:{cardinal:u[4]},syr:{cardinal:u[0]},ta:{cardinal:u[0]},te:{cardinal:u[0]},teo:{cardinal:u[0]},ti:{cardinal:u[1]},tig:{cardinal:u[0]},tk:{cardinal:u[0],ordinal:u[52]},tl:{cardinal:u[13],ordinal:u[0]},tn:{cardinal:u[0]},tr:{cardinal:u[0]},ts:{cardinal:u[0]},tzm:{cardinal:u[33]},ug:{cardinal:u[0]},uk:{cardinal:u[29],ordinal:u[53]},ur:{cardinal:u[4]},uz:{cardinal:u[0]},ve:{cardinal:u[0]},vo:{cardinal:u[0]},vun:{cardinal:u[0]},wa:{cardinal:u[1]},wae:{cardinal:u[0]},xh:{cardinal:u[0]},xog:{cardinal:u[0]},yi:{cardinal:u[4]},zu:{cardinal:u[2]},lo:{ordinal:u[0]},ms:{ordinal:u[0]},vi:{ordinal:u[0]}}},function(t,e){t.exports=class{constructor(){this._requestID=0,this._openRequests={}}sendRemoteRequest(t,e){const n=this._requestID++,r=new Promise(((t,e)=>{this._openRequests[n]={resolve:t,reject:e}}));return this._sendRequest(t,e,n),r}sendRemoteNotification(t,e){this._sendRequest(t,e)}didReceiveCall(){throw new Error("Must override didReceiveCall")}_sendMessage(){throw new Error("Must override _sendMessage")}_sendRequest(t,e,n){const r={jsonrpc:"2.0",method:t,params:e};null!==n&&(r.id=n),this._sendMessage(r)}_handleMessage(t){if("2.0"!==t.jsonrpc)throw new Error("Bad or missing JSON-RPC version in message: ".concat(t));Object.prototype.hasOwnProperty.call(t,"method")?this._handleRequest(t):this._handleResponse(t)}_sendResponse(t,e,n){const r={jsonrpc:"2.0",id:t};n?r.error=n:r.result=e||null,this._sendMessage(r)}_handleResponse(t){const{result:e,error:n,id:r}=t,i=this._openRequests[r];delete this._openRequests[r],i&&(n?i.reject(n):i.resolve(e))}_handleRequest(t){const{method:e,params:n,id:r}=t,i=this.didReceiveCall(e,n);null!=r&&Promise.resolve(i).then((t=>{this._sendResponse(r,t)}),(t=>{this._sendResponse(r,null,t)}))}}},function(t){t.exports=JSON.parse('{"menuMap":{"cs":[{"code":"cs","name":"čeština"}],"da":[{"code":"da","name":"Dansk"}],"gl":[{"code":"gl","name":"galego"}],"sl":[{"code":"sl","name":"slovenščina"}],"fr":[{"code":"fr","name":"Français"}],"hu":[{"code":"hu","name":"magyar"}],"uk":[{"code":"uk","name":"українська"}],"zh-tw":[{"code":"zh-tw","name":"中文(繁體)"}],"pt":[{"code":"pt","name":"Portuguese"}],"pt-br":[{"code":"pt","name":"Português"}],"tr":[{"code":"tr","name":"Türkçe"}],"ga":[{"code":"ga","name":"Gaeilge"}],"th":[{"code":"th","name":"ภาษาไทย"}],"ja":[{"code":"ja","name":"日本語"}],"ja-hira":[{"code":"ja","name":"日本語"}],"nl":[{"code":"nl","name":"Nederlands"}],"gd":[{"code":"gd","name":"Gàidhlig"}],"nb":[{"code":"nb","name":"norsk"}],"de":[{"code":"de","name":"Deutsch"}],"he":[{"code":"he","name":"עברית"}],"sk":[{"code":"sk","name":"slovenčina"}],"zu":[{"code":"zu","name":"isiZulu"}],"ru":[{"code":"ru","name":"русский"}],"pl":[{"code":"pl","name":"polski"}],"am":[{"code":"am","name":"አማርኛ"}],"az":[{"code":"az","name":"Azərbaycan dili"}],"hr":[{"code":"hr","name":"hrvatski"}],"fa":[{"code":"fa","name":"فارسی"}],"mi":[{"code":"mi","name":"Māori"}],"el":[{"code":"el","name":"Ελληνικά"}],"is":[{"code":"is","name":"íslenska"}],"fi":[{"code":"fi","name":"suomi"}],"eu":[{"code":"eu","name":"euskara"}],"ca":[{"code":"ca","name":"català"}],"lv":[{"code":"lv","name":"latviešu"}],"id":[{"code":"id","name":"Indonesia"}],"es":[{"code":"es","name":"español"}],"es-419":[{"code":"es","name":"español"}],"et":[{"code":"et","name":"eesti"}],"cy":[{"code":"cy","name":"Cymraeg"}],"zh-cn":[{"code":"zh-cn","name":"中文(简体)"}],"bg":[{"code":"bg","name":"български"}],"ar":[{"code":"ar","name":"العربية"}],"en":[{"code":"en","name":"English"}],"sr":[{"code":"sr","name":"српски"}],"sv":[{"code":"sv","name":"svenska"}],"ro":[{"code":"ro","name":"Română"}],"lt":[{"code":"lt","name":"lietuvių"}],"ko":[{"code":"ko","name":"한국어"}],"it":[{"code":"it","name":"Italiano"}],"vi":[{"code":"vi","name":"Tiếng Việt"}]},"nameMap":{"albánština":"sq","amharština":"am","angličtina":"en","arabština":"ar","arménština":"hy","ázerbájdžánština":"az","barmština":"my","baskičtina":"eu","běloruština":"be","bulharština":"bg","čeština":"cs","čínština (tradiční)":"zh-tw","čínština (zjednodušená)":"zh-cn","dánština":"da","esperanto":"eo","estonština":"et","finština":"fi","francouzština":"fr","galicijština":"gl","haitská kreolština":"ht","hebrejština":"he","hindština":"hi","holandština":"nl","chorvatština":"hr","indonéština":"id","irština":"ga","islandština":"is","italština":"it","japonština":"ja","kannadština":"kn","katalánština":"ca","korejština":"ko","kurdština":"ku","latina":"la","litevština":"lt","lotyština":"lv","maďarština":"hu","makedonština":"mk","malajálamština":"ml","malajština":"ms","maltština":"mt","maorština":"mi","marátština":"mr","mongolština":"mn","němčina":"de","norština":"nb","perština":"fa","polština":"pl","portugalština":"pt","rumunština":"ro","ruština":"ru","řečtina":"el","skotská gaelština":"gd","slovenština":"sk","slovinština":"sl","srbština":"sr","španělština":"es","švédština":"sv","telužština":"te","thajština":"th","turečtina":"tr","ukrajinština":"uk","uzbečtina":"uz","velština":"cy","vietnamština":"vi","zulu":"zu","albansk":"sq","amharisk":"am","arabisk":"ar","armensk":"hy","aserbajdsjansk":"az","baskisk":"eu","bulgarsk":"bg","burmesisk":"my","dansk":"da","engelsk":"en","estisk":"et","finsk":"fi","fransk":"fr","galicisk":"gl","græsk":"el","haitisk kreolsk":"ht","hebraisk":"he","hindi":"hi","hollandsk":"nl","hviderussisk":"be","indonesisk":"id","irsk":"ga","islandsk":"is","italiensk":"it","japansk":"ja","kannada":"kn","katalansk":"ca","kinesisk (forenklet)":"zh-cn","kinesisk (traditionelt)":"zh-tw","koreansk":"ko","kroatisk":"hr","kurdisk":"ku","latin":"la","lettisk":"lv","litauisk":"lt","makedonsk":"mk","malajisk":"ms","malayalam":"ml","maltesisk":"mt","maori":"mi","marathi":"mr","mongolsk":"mn","norsk":"nb","persisk":"fa","polsk":"pl","portugisisk":"pt","rumænsk":"ro","russisk":"ru","serbisk":"sr","skotsk gælisk":"gd","slovakisk":"sk","slovensk":"sl","spansk":"es","svensk":"sv","telugu":"te","thailandsk":"th","tjekkisk":"cs","tyrkisk":"tr","tysk":"de","ukrainsk":"uk","ungarsk":"hu","usbekisk":"uz","vietnamesisk":"vi","walisisk":"cy","acerbaixano":"az","albanés":"sq","alemán":"de","amárico":"am","árabe":"ar","armenio":"hy","bielorruso":"be","birmano":"my","búlgaro":"bg","canarés":"kn","catalán":"ca","checo":"cs","chinés (simplificado)":"zh-cn","chinés (tradicional)":"zh-tw","coreano":"ko","crioulo haitiano":"ht","croata":"hr","curdo":"ku","dinamarqués":"da","eslovaco":"sk","esloveno":"sl","español":"es","estoniano":"et","éuscaro":"eu","finés":"fi","francés":"fr","gaélico escocés":"gd","galego":"gl","galés":"cy","grego":"el","hebreo":"he","húngaro":"hu","indonesio":"id","inglés":"en","irlandés":"ga","islandés":"is","italiano":"it","latín":"la","letón":"lv","lituano":"lt","macedonio":"mk","malabar":"ml","malaio":"ms","maltés":"mt","maorí":"mi","mongol":"mn","neerlandés":"nl","noruegués":"nb","persa":"fa","polaco":"pl","portugués":"pt","romanés":"ro","ruso":"ru","serbio":"sr","sueco":"sv","tailandés":"th","telugú":"te","turco":"tr","ucraíno":"uk","usbeco":"uz","vietnamita":"vi","xaponés":"ja","zulú":"zu","albanščina":"sq","amharščina":"am","angleščina":"en","arabščina":"ar","armenščina":"hy","azerbajdžanščina":"az","baskovščina":"eu","beloruščina":"be","bolgarščina":"bg","burmanščina":"my","češčina":"cs","danščina":"da","estonščina":"et","finščina":"fi","francoščina":"fr","galicijščina":"gl","grščina":"el","haitijska kreolščina":"ht","hebrejščina":"he","hindijščina":"hi","hrvaščina":"hr","indonezijščina":"id","irščina":"ga","islandščina":"is","italijanščina":"it","japonščina":"ja","kanareščina":"kn","katalonščina":"ca","kitajščina (poenostavljena)":"zh-cn","kitajščina (tradicionalna)":"zh-tw","korejščina":"ko","kurdščina":"ku","latinščina":"la","latvijščina":"lv","litovščina":"lt","madžarščina":"hu","makedonščina":"mk","malajalščina":"ml","malajščina":"ms","malteščina":"mt","maorščina":"mi","maratščina":"mr","mongolščina":"mn","nemščina":"de","nizozemščina":"nl","norveščina":"nb","perzijščina":"fa","poljščina":"pl","portugalščina":"pt","romunščina":"ro","ruščina":"ru","slovaščina":"sk","slovenščina":"sl","srbščina":"sr","škotska gelščina":"gd","španščina":"es","švedščina":"sv","tajščina":"th","teluščina":"te","turščina":"tr","ukrajinščina":"uk","uzbeščina":"uz","valižanščina":"cy","vietnamščina":"vi","zulujščina":"zu","albanais":"sq","allemand":"de","amharique":"am","anglais":"en","arabe":"ar","arménien":"hy","azéri":"az","basque":"eu","biélorusse":"be","birman":"my","bulgare":"bg","catalan":"ca","chinois (simplifié)":"zh-cn","chinois (traditionnel)":"zh-tw","coréen":"ko","créole haïtien":"ht","croate":"hr","danois":"da","espagnol":"es","espéranto":"eo","estonien":"et","finnois":"fi","français":"fr","gaélique (écosse)":"gd","galicien":"gl","gallois":"cy","grec":"el","hébreu":"he","hongrois":"hu","indonésien":"id","irlandais":"ga","islandais":"is","italien":"it","japonais":"ja","kurde":"ku","letton":"lv","lituanien":"lt","macédonien":"mk","malaisien":"ms","maltais":"mt","néerlandais":"nl","norvégien":"nb","ouzbek":"uz","persan":"fa","polonais":"pl","portugais":"pt","roumain":"ro","russe":"ru","serbe":"sr","slovaque":"sk","slovène":"sl","suédois":"sv","tchèque":"cs","thaï":"th","turc":"tr","ukrainien":"uk","vietnamien":"vi","zoulou":"zu","albán":"sq","amhara":"am","angol":"en","arab":"ar","azeri":"az","baszk":"eu","belorusz":"be","bolgár":"bg","burmai":"my","cseh":"cs","dán":"da","eszperantó":"eo","észt":"et","finn":"fi","francia":"fr","galíciai":"gl","görög":"el","haiti kreol":"ht","héber":"he","holland":"nl","horvát":"hr","indonéz":"id","ír":"ga","izlandi":"is","japán":"ja","katalán":"ca","kínai (egyszerűsített)":"zh-cn","kínai (hagyományos)":"zh-tw","koreai":"ko","kurd":"ku","lengyel":"pl","lett":"lv","litván":"lt","macedón":"mk","magyar":"hu","maláj":"ms","malajálam":"ml","máltai":"mt","maráthi":"mr","német":"de","norvég":"nb","olasz":"it","orosz":"ru","örmény":"hy","perzsa":"fa","portugál":"pt","román":"ro","skót-gael":"gd","spanyol":"es","svéd":"sv","szerb":"sr","szlovák":"sk","szlovén":"sl","thai":"th","török":"tr","ukrán":"uk","üzbég":"uz","vietnami":"vi","walesi":"cy","азербайджанська":"az","албанська":"sq","амхарська":"am","англійська":"en","арабська":"ar","баскська":"eu","білоруська":"be","бірманська":"my","болгарська":"bg","в’єтнамська":"vi","валлійська":"cy","вірменська":"hy","гаїтянська креольська":"ht","гінді":"hi","грецька":"el","ґалісійська":"gl","данська":"da","есперанто":"eo","естонська":"et","зулу":"zu","іврит":"he","індонезійська":"id","ірландська":"ga","ісландська":"is","іспанська":"es","італійська":"it","каннада":"kn","каталанська":"ca","китайська (спрощена)":"zh-cn","китайська (традиційна)":"zh-tw","корейська":"ko","курдська":"ku","латинська":"la","латиська":"lv","литовська":"lt","македонська":"mk","малайська":"ms","малаялам":"ml","мальтійська":"mt","маорі":"mi","маратхі":"mr","монгольська":"mn","нідерландська":"nl","німецька":"de","норвезька":"nb","перська":"fa","польська":"pl","португальська":"pt","російська":"ru","румунська":"ro","сербська":"sr","словацька":"sk","словенська":"sl","тайська":"th","телуґу":"te","турецька":"tr","угорська":"hu","узбецька":"uz","українська":"uk","фінська":"fi","французька":"fr","хорватська":"hr","чеська":"cs","шведська":"sv","шотландська (ґельська)":"gd","японська":"ja","土耳其文":"tr","中文(繁體)":"zh-tw","中文(簡體)":"zh-cn","丹麥文":"da","巴斯克文":"eu","日文":"ja","毛利文":"mi","世界語":"eo","加里西亞文":"gl","加泰羅尼亞文":"ca","卡納達文":"kn","白俄羅斯文":"be","立陶宛文":"lt","冰島文":"is","匈牙利文":"hu","印尼文":"id","印度文":"hi","西班牙文":"es","克羅埃西亞文":"hr","希伯來文":"he","希臘文":"el","亞美尼亞文":"hy","亞塞拜然文":"az","拉丁文":"la","拉脫維亞文":"lv","法文":"fr","波斯文":"fa","波蘭文":"pl","芬蘭文":"fi","阿姆哈拉文":"am","阿拉伯文":"ar","阿爾巴尼亞文":"sq","俄文":"ru","保加利亞文":"bg","南非祖魯文":"zu","威爾斯文":"cy","英文":"en","庫德文":"ku","挪威文":"nb","泰文":"th","泰盧固文":"te","海地克里奧文":"ht","烏克蘭文":"uk","烏茲別克文":"uz","馬耳他文":"mt","馬來文":"ms","馬其頓文":"mk","馬拉地文":"mr","馬拉雅拉姆文":"ml","捷克文":"cs","荷蘭文":"nl","斯洛伐克文":"sk","斯洛維尼亞文":"sl","越南文":"vi","塞爾維亞文":"sr","愛沙尼亞文":"et","愛爾蘭文":"ga","瑞典文":"sv","義大利文":"it","葡萄牙文":"pt","蒙古文":"mn","德文":"de","緬甸文":"my","韓文":"ko","羅馬尼亞文":"ro","蘇格蘭的蓋爾文":"gd","अझरबैजानी":"az","अम्हारिक":"am","अरबी":"ar","अर्मेनियन":"hy","अल्बानियन":"sq","आइसलँडिक":"is","आयरिश":"ga","इंग्रजी":"en","इंडोनेशियन":"id","इटालियन":"it","उझ्बेक":"uz","एस्टोनियन":"et","एस्परँटो":"eo","कन्नड":"kn","कुर्दिश (कुर्मांजी)":"ku","कॅटलान":"ca","कोरियन":"ko","क्रोएशियन":"hr","गॅलिशियन":"gl","ग्रीक":"el","चीनी (पारंपारिक)":"zh-tw","चीनी (सरलीकृत)":"zh-cn","जपानी":"ja","जर्मन":"de","झुलु":"zu","झेक":"cs","डच":"nl","डॅनिश":"da","तुर्की":"tr","तेलगू":"te","थाई":"th","नॉर्वेजियन":"nb","पोर्तुगीज":"pt","पोलिश":"pl","फारसी":"fa","फिन्निश":"fi","फ्रेंच":"fr","बल्गेरियन":"bg","बास्क":"eu","बेलारुशियन":"be","मंगोलियन":"mn","मराठी":"mr","मलय":"ms","मल्याळम":"ml","माओरी":"mi","माल्टीज":"mt","मॅसेडोनियन":"mk","म्यानमार (बर्मीज)":"my","युक्रेनियन":"uk","रशियन":"ru","रोमानियन":"ro","लाट्वियन":"lv","लिथुआनियन":"lt","लॅटिन":"la","वेल्श":"cy","व्हिएतनामी":"vi","सर्बियन":"sr","स्कॉट्स गेलिक":"gd","स्पॅनिश":"es","स्लोव्हाक":"sk","स्लोव्हेनियन":"sl","स्वीडिश":"sv","हंगेरियन":"hu","हिन्दी":"hi","हिब्रू":"he","हैतीयन क्रेओल":"ht","albanian":"sq","amharic":"am","arabic":"ar","armenian":"hy","azerbaijani":"az","belarusian":"be","bulgarian":"bg","chinese (simplified)":"zh-cn","chinese (traditional)":"zh-tw","croatian":"hr","czech":"cs","danish":"da","dutch":"nl","english":"en","estonian":"et","finnish":"fi","french":"fr","galician":"gl","german":"de","greek":"el","haitian creole":"ht","hebrew":"he","hungarian":"hu","icelandic":"is","indonesian":"id","irish":"ga","italian":"it","japanese":"ja","korean":"ko","kurdish (kurmanji)":"ku","latvian":"lv","lithuanian":"lt","macedonian":"mk","malay":"ms","maltese":"mt","mongolian":"mn","myanmar (burmese)":"my","norwegian":"nb","persian":"fa","polish":"pl","portuguese":"pt","romanian":"ro","russian":"ru","scots gaelic":"gd","serbian":"sr","slovak":"sk","slovenian":"sl","spanish":"es","swedish":"sv","turkish":"tr","ukrainian":"uk","uzbek":"uz","vietnamese":"vi","welsh":"cy","albanês":"sq","alemão":"de","armênio":"hy","azerbaijano":"az","basco":"eu","bielo-russo":"be","birmanês":"my","canarês":"kn","catalão":"ca","chinês (simplificado)":"zh-cn","chinês (tradicional)":"zh-tw","dinamarquês":"da","espanhol":"es","finlandês":"fi","francês":"fr","gaélico escocês":"gd","galês":"cy","hebraico":"he","holandês":"nl","indonésio":"id","inglês":"en","irlandês":"ga","islandês":"is","japonês":"ja","latim":"la","letão":"lv","macedônio":"mk","malaiala":"ml","maltês":"mt","marata":"mr","norueguês":"nb","polonês":"pl","português":"pt","romeno":"ro","russo":"ru","sérvio":"sr","tailandês":"th","tcheco":"cs","telugo":"te","ucraniano":"uk","uzbeque":"uz","almanca":"de","arapça":"ar","arnavutça":"sq","azerice":"az","baskça":"eu","belarusça":"be","bulgarca":"bg","burmaca":"my","çekçe":"cs","çince (basitleştirilmiş)":"zh-cn","çince (geleneksel)":"zh-tw","danca":"da","endonezya dili":"id","ermenice":"hy","esperantoca":"eo","estonyaca":"et","farsça":"fa","felemenkçe":"nl","fince":"fi","fransızca":"fr","galce":"cy","galiçyaca":"gl","habeşçe":"am","haiti creole dili":"ht","hırvatça":"hr","hintçe":"hi","i̇branice":"he","i̇ngilizce":"en","i̇rlandaca":"ga","i̇spanyolca":"es","i̇sveççe":"sv","i̇talyanca":"it","i̇zlandaca":"is","japonca":"ja","katalanca":"ca","korece":"ko","kuzey i̇skoç dili":"gd","kürtçe":"ku","latince":"la","lehçe":"pl","letonca":"lv","litvanca":"lt","macarca":"hu","makedonca":"mk","malezya dili":"ms","malta dili":"mt","maori dili":"mi","moğolca":"mn","norveççe":"nb","özbekçe":"uz","portekizce":"pt","romence":"ro","rusça":"ru","sırpça":"sr","slovakça":"sk","slovence":"sl","tay dili":"th","telugu dili":"te","türkçe":"tr","ukraynaca":"uk","vietnamca":"vi","yunanca":"el","airméinis":"hy","albáinis":"sq","amárais":"am","araibis":"ar","asarbaiseáinis":"az","bascais":"eu","bealarúisis":"be","béarla":"en","breatnais":"cy","bulgáiris":"bg","cannadais":"kn","catalóinis":"ca","coirdis (curmainsis)":"ku","cóiréis":"ko","criól háítí":"ht","cróitis":"hr","danmhairgis":"da","eabhrais":"he","eastóinis":"et","fionlainnis":"fi","fraincis":"fr","gaeilge":"ga","gaeilge na halban":"gd","gailísis":"gl","gearmáinis":"de","gréigis":"el","hiondúis":"hi","indinéisis":"id","iodáilis":"it","ioruais":"nb","íoslainnis":"is","laidin":"la","laitvis":"lv","liotuáinis":"lt","macadóinis":"mk","maenmar (burmais)":"my","mailéalaimis":"ml","malaeis":"ms","máltais":"mt","maorais":"mi","maraitis":"mr","mongóilis":"mn","ollainnis":"nl","peirsis":"fa","polainnis":"pl","portaingéilis":"pt","rómáinis":"ro","rúisis":"ru","seapáinis":"ja","seicis":"cs","seirbis":"sr","sínis (simplithe)":"zh-cn","sínis (traidisiúnta)":"zh-tw","slóivéinis":"sl","slóvaicis":"sk","spáinnis":"es","sualainnis":"sv","súlúis":"zu","téalainnis":"th","teileagúis":"te","tuircis":"tr","úcráinis":"uk","úisbéiceastáinis":"uz","ungáiris":"hu","vítneaimis":"vi","ภาษากรีก":"el","ภาษากันนาดา":"kn","ภาษากาลิเชียน":"gl","ภาษาเกลิกในสก็อต":"gd","ภาษาเกาหลี":"ko","ภาษาคาตาลัน":"ca","ภาษาเคิร์ด":"ku","ภาษาโครเอเชีย":"hr","ภาษาจีน (ดั้งเดิม)":"zh-tw","ภาษาจีน (แบบย่อ)":"zh-cn","ภาษาเช็ก":"cs","ภาษาซูลู":"zu","ภาษาเซอร์เบียน":"sr","ภาษาญี่ปุ่น":"ja","ภาษาดัตช์":"nl","ภาษาเดนมาร์ก":"da","ภาษาตุรกี":"tr","ภาษาเตลูกู":"te","ภาษาไทย":"th","ภาษานอร์เวย์":"nb","ภาษาบัลกาเรีย":"bg","ภาษาบาสก์":"eu","ภาษาเบลารูเชียน":"be","ภาษาเปอร์เซีย":"fa","ภาษาโปรตุเกส":"pt","ภาษาโปแลนด์":"pl","ภาษาฝรั่งเศส":"fr","ภาษาฟินแลนด์":"fi","ภาษามองโกเลีย":"mn","ภาษามัลทีส":"mt","ภาษามาซีโดเนีย":"mk","ภาษามาราฐี":"mr","ภาษามาลายาลัม":"ml","ภาษามาเลย์":"ms","ภาษาเมารี":"mi","ภาษาเมียนมา (พม่า)":"my","ภาษายูเครน":"uk","ภาษาเยอรมัน":"de","ภาษารัสเซีย":"ru","ภาษาโรมาเนีย":"ro","ภาษาละติน":"la","ภาษาลัทเวีย":"lv","ภาษาลิทัวเนีย":"lt","ภาษาเวลส์":"cy","ภาษาเวียดนาม":"vi","ภาษาสเปน":"es","ภาษาสโลวัก":"sk","ภาษาสโลเวเนีย":"sl","ภาษาสวีเดน":"sv","ภาษาอังกฤษ":"en","ภาษาอัมฮาริก":"am","ภาษาอัลบาเนีย":"sq","ภาษาอาร์เซอร์ไบจัน":"az","ภาษาอาร์เมเนีย":"hy","ภาษาอาหรับ":"ar","ภาษาอิตาลี":"it","ภาษาอินโดนีเซีย":"id","ภาษาอุสเบกิสถาน":"uz","ภาษาเอสโทเนีย":"et","ภาษาเอสเปอแรนโต":"eo","ภาษาไอซ์แลนดิก":"is","ภาษาไอริช":"ga","ภาษาฮังการี":"hu","ภาษาฮินดี":"hi","ภาษาฮิบรู":"he","ภาษาเฮติครีโอล":"ht","アイスランド語":"is","アイルランド語":"ga","アゼルバイジャン語":"az","アムハラ語":"am","アラビア語":"ar","アルバニア語":"sq","アルメニア語":"hy","イタリア語":"it","インドネシア語":"id","ウェールズ語":"cy","ウクライナ語":"uk","ウズベク語":"uz","エストニア語":"et","エスペラント語":"eo","オランダ語":"nl","カタルーニャ語":"ca","ガリシア語":"gl","カンナダ語":"kn","ギリシャ語":"el","クルド語":"ku","クロアチア語":"hr","スウェーデン語":"sv","ズールー語":"zu","スコットランド ゲール語":"gd","スペイン語":"es","スロバキア語":"sk","スロベニア語":"sl","セルビア語":"sr","タイ語":"th","チェコ語":"cs","テルグ語":"te","デンマーク語":"da","ドイツ語":"de","トルコ語":"tr","ノルウェー語":"nb","ハイチ語":"ht","バスク語":"eu","ハンガリー語":"hu","ヒンディー語":"hi","フィンランド語":"fi","フランス語":"fr","ブルガリア語":"bg","ベトナム語":"vi","ヘブライ語":"he","ベラルーシ語":"be","ペルシャ語":"fa","ポーランド語":"pl","ポルトガル語":"pt","マオリ語":"mi","マケドニア語":"mk","マラーティー語":"mr","マラヤーラム語":"ml","マルタ語":"mt","マレー語":"ms","ミャンマー語":"my","モンゴル語":"mn","ラテン語":"la","ラトビア語":"lv","リトアニア語":"lt","ルーマニア語":"ro","ロシア語":"ru","英語":"en","韓国語":"ko","中国語(簡体)":"zh-cn","中国語(繁体)":"zh-tw","日本語":"ja","albanees":"sq","amharisch":"am","arabisch":"ar","armeens":"hy","azerbeidzjaans":"az","baskisch":"eu","birmaans":"my","bulgaars":"bg","catalaans":"ca","chinees (traditioneel)":"zh-tw","chinees (vereenvoudigd)":"zh-cn","deens":"da","duits":"de","engels":"en","ests":"et","fins":"fi","frans":"fr","galicisch":"gl","grieks":"el","haïtiaans creools":"ht","hebreeuws":"he","hongaars":"hu","iers":"ga","ijslands":"is","indonesisch":"id","italiaans":"it","japans":"ja","koerdisch":"ku","koreaans":"ko","kroatisch":"hr","latijn":"la","lets":"lv","litouws":"lt","macedonisch":"mk","maleis":"ms","maltees":"mt","mongools":"mn","nederlands":"nl","noors":"nb","oekraïens":"uk","oezbeeks":"uz","perzisch":"fa","pools":"pl","portugees":"pt","roemeens":"ro","russisch":"ru","schots keltisch":"gd","servisch":"sr","slovaaks":"sk","sloveens":"sl","spaans":"es","tsjechisch":"cs","turks":"tr","vietnamees":"vi","wels":"cy","wit-russisch":"be","zoeloe":"zu","zweeds":"sv","airmeinis":"hy","albàinis":"sq","amtharais":"am","arabais":"ar","asarbaideànais":"az","basgais":"eu","bealaruisis":"be","beurla":"en","bhiet-namais":"vi","bulgarais":"bg","cànan nan tàidh":"th","catalanais":"ca","coirèanais":"ko","crìtheol haidhti":"ht","cròthaisis":"hr","cuimris":"cy","cùrdais (kurmanji)":"ku","duitsis":"nl","eabhra":"he","eadailtis":"it","eastoinis":"et","fionnlannais":"fi","fraingis":"fr","gàidhlig":"gd","gailìsis":"gl","gearmailtis":"de","grèigis":"el","hindis":"hi","innd-innsis":"id","innis-tìlis":"is","laideann":"la","laitbheis":"lv","liotuainis":"lt","malaidhis":"ms","māori":"mi","masadonais":"mk","miànmar (burmais)":"my","mongolais":"mn","nirribhis":"nb","pòlainnis":"pl","portagailis":"pt","romàinis":"ro","ruisis":"ru","seacais":"cs","seapanais":"ja","sèirbis":"sr","sìonais (seann-nòsach)":"zh-tw","sìonais (sìmplichte)":"zh-cn","slòbhacais":"sk","slòbhainis":"sl","spàinntis":"es","suainis":"sv","turcais":"tr","ucràinis":"uk","ungairis":"hu","usbagais":"uz","farsi":"fa","galisisk":"gl","gresk":"el","hviterussisk":"be","kinesisk (tradisjonell)":"zh-tw","kreol (haiti)":"ht","latvisk":"lv","malayisk":"ms","nederlandsk":"nl","rumensk":"ro","tsjekkisk":"cs","albanisch":"sq","armenisch":"hy","aserbaidschanisch":"az","birmanisch":"my","bulgarisch":"bg","chinesisch (traditionell)":"zh-tw","chinesisch (vereinfacht)":"zh-cn","dänisch":"da","deutsch":"de","englisch":"en","estnisch":"et","finnisch":"fi","französisch":"fr","galizisch":"gl","griechisch":"el","haitianisch":"ht","hebräisch":"he","irisch":"ga","isländisch":"is","italienisch":"it","japanisch":"ja","katalanisch":"ca","koreanisch":"ko","kurdisch (kurmandschi)":"ku","lateinisch":"la","lettisch":"lv","litauisch":"lt","malaysisch":"ms","maltesisch":"mt","mazedonisch":"mk","mongolisch":"mn","niederländisch":"nl","norwegisch":"nb","persisch":"fa","polnisch":"pl","portugiesisch":"pt","rumänisch":"ro","schottisch-gälisch":"gd","schwedisch":"sv","serbisch":"sr","slowakisch":"sk","slowenisch":"sl","spanisch":"es","thailändisch":"th","tschechisch":"cs","türkisch":"tr","ukrainisch":"uk","ungarisch":"hu","usbekisch":"uz","vietnamesisch":"vi","walisisch":"cy","weißrussisch":"be","ကနာဒါ":"kn","ကာ့ဒ် (ကာမန်ဂျီ)":"ku","ကိုရီးယား":"ko","ကက်တလန်":"ca","ခရိုအေးရှား":"hr","ချက်":"cs","ဂရိ":"el","ဂယ်လိရှ":"gl","ဂျပန်":"ja","ဂျာမန်":"de","စကော့ ဂေးလစ်":"gd","စပိန်":"es","ဆလိုဗေးနီးယား":"sl","ဆလိုဗက်":"sk","ဆားဘီးယား":"sr","ဆွီဒင်":"sv","ဇူးလူး":"zu","တရုတ် (ရိုးရာ)":"zh-tw","တရုတ် (အလွယ်)":"zh-cn","တူ​ရ​ကီ":"tr","တယ်လူဂူ":"te","ထိုင်း":"th","ဒတ်ချ်":"nl","ဒိန်းမတ်":"da","နော်ဝေ":"nb","ပါရှန်":"fa","ပေါ်တူဂီ":"pt","ပိုလန်":"pl","ပြင်သစ်":"fr","ဖင်လန်":"fi","ဗီယက်နမ်":"vi","ဘာ့စ်":"eu","ဘူဂေးရီးယား":"bg","ဘယ်လာရုစ်":"be","မလေယာလမ်":"ml","မလေး":"ms","မာရာသီ":"mr","မော်ရီ":"mi","မော်လတာ":"mt","မက်ဆီဒိုးနီးယား":"mk","မြန်မာ (မြန်မာ)":"my","မွန်ဂိုလီးယား":"mn","ယူ​က​ရိန်း​":"uk","ရုရှား":"ru","ရိုမေးနီးယား":"ro","လက်တင်":"la","လစ်သူယေးနီးယား":"lt","လတ်ဗီယာ":"lv","ဝေလ":"cy","ဟီဘရူး":"he","ဟေတီ ခရီအိုး":"ht","ဟင်ဒီ":"hi","ဟန်ဂေရီ":"hu","အဇာဘိုင်ဂျန်":"az","အာမေးနီးယား":"hy","အာရေဗျ":"ar","အီတလီ":"it","ဥဇဘက်":"uz","အက်စတိုးနီးယား":"et","အက်စ်ပဲရန်တို":"eo","အိုက်စလန်":"is","အင်္ဂလိပ်":"en","အင်ဒိုနီးရှား":"id","အိုင်းရစ်ရှ်":"ga","အမ်ဟဲရစ်ခ်":"am","အယ်လ်ဘေးနီးယား":"sq","אוזבקית":"uz","אוקראינית":"uk","אזרית":"az","איטלקית":"it","אינדונזית":"id","איסלנדית":"is","אירית":"ga","אלבנית":"sq","אמהרית":"am","אנגלית":"en","אסטונית":"et","אספרנטו":"eo","ארמנית":"hy","באסקית":"eu","בולגרית":"bg","בורמזית":"my","בלארוסית":"be","גליציאנית":"gl","גרמנית":"de","דנית":"da","הולנדית":"nl","הונגרית":"hu","הינדי":"hi","וולשית":"cy","וייטנאמית":"vi","זולו":"zu","טורקית":"tr","טלוגו":"te","יוונית":"el","יפנית":"ja","כורדית":"ku","לטווית":"lv","לטינית":"la","ליטאית":"lt","מאורית":"mi","מאלאיאלם":"ml","מאלזית":"ms","מאראתי":"mr","מונגולית":"mn","מלטית":"mt","מקדונית":"mk","נורווגית":"nb","סינית (מסורתית)":"zh-tw","סינית (פשוטה)":"zh-cn","סלובנית":"sl","סלובקית":"sk","ספרדית":"es","סקוטית גאלית":"gd","סרבית":"sr","עברית":"he","ערבית":"ar","פולנית":"pl","פורטוגזית":"pt","פינית":"fi","פרסית":"fa","צ\'כית":"cs","צרפתית":"fr","קאנאדה":"kn","קוריאנית":"ko","קטלאנית":"ca","קרואטית":"hr","קריאולית האיטית":"ht","רומנית":"ro","רוסית":"ru","שוודית":"sv","תאילנדית":"th","азербејџански":"az","албански":"sq","амхарски":"am","англиски":"en","арапски":"ar","баскиски":"eu","белоруски":"be","бугарски":"bg","бурмански":"my","велшки":"cy","виетнамски":"vi","галициски":"gl","германски":"de","грчки":"el","дански":"da","ерменски":"hy","естонски":"et","индонезиски":"id","ирски":"ga","исландски":"is","италијански":"it","јапонски":"ja","канада":"kn","каталонски":"ca","кинески (поедноставен)":"zh-cn","кинески (традиционален)":"zh-tw","корејски":"ko","курдски":"ku","латвиски":"lv","латински":"la","литвански":"lt","македонски":"mk","малајалам":"ml","малајски":"ms","малтешки":"mt","маорски":"mi","маратхи":"mr","монголски":"mn","норвешки":"nb","персиски":"fa","полски":"pl","португалски":"pt","романски":"ro","руски":"ru","словачки":"sk","словенечки":"sl","српски":"sr","тајландски":"th","телугу":"te","турски":"tr","узбечки":"uz","украински":"uk","унгарски":"hu","фински":"fi","француски":"fr","хаитски креолски":"ht","хебрејски":"he","хиндиски":"hi","холандски":"nl","хрватски":"hr","чешки":"cs","шведски":"sv","шкотски галски":"gd","шпански":"es","ಅಜರ್ಬೈಜಾನಿ":"az","ಅಮಹಾರಿಕ್":"am","ಅರಬ್ಬಿ":"ar","ಆರ್ಮೇನಿಯನ್":"hy","ಆಲ್ಬೇನಿಯನ್":"sq","ಇಂಗ್ಲಿಷ್‌‌":"en","ಇಂಡೋನೇಷಿಯನ್":"id","ಇಟಾಲಿಯನ್":"it","ಉಜ್ಬೆಕ್":"uz","ಎಸ್ಟೋನಿಯನ್":"et","ಎಸ್ಪೆರಾಂಟೋ":"eo","ಐರಿಷ್":"ga","ಐಸ್‌ಲ್ಯಾಂಡಿಕ್‌":"is","ಕನ್ನಡ":"kn","ಕುರ್ದಿಶ್":"ku","ಕೊರಿಯನ್":"ko","ಕ್ಯಾಟಲನ್":"ca","ಕ್ರೊಯೇಷಿಯನ್":"hr","ಗ್ಯಾಲೀಷಿಯನ್":"gl","ಗ್ರೀಕ್":"el","ಚೀನಿ (ಸರಳೀಕೃತ)":"zh-cn","ಚೀನಿ (ಸಾಂಪ್ರದಾಯಿಕ)":"zh-tw","ಜಪಾನಿ":"ja","ಜರ್ಮನ್":"de","ಜುಲು":"zu","ಝೆಕ್‌":"cs","ಟರ್ಕಿಷ್":"tr","ಡಚ್":"nl","ಡ್ಯಾನಿಷ್":"da","ತೆಲುಗು":"te","ಥಾಯ್":"th","ನಾರ್ವೇಜಿಯನ್‌":"nb","ಪೋರ್ಚುಗೀಸ್":"pt","ಪೋಲಿಷ್":"pl","ಫಾರ್ಸಿ":"fa","ಫಿನ್ನಿಷ್":"fi","ಫ್ರೆಂಚ್":"fr","ಬರ್ಮೀಸ್":"my","ಬಲ್ಗೇರಿಯನ್":"bg","ಬಾಸ್ಕ್":"eu","ಬೆಲರೂಸಿಯನ್":"be","ಮಂಗೋಲಿಯನ್":"mn","ಮರಾಠಿ":"mr","ಮಲಯ":"ms","ಮಲಯಾಳಂ":"ml","ಮಾಲ್ಟೀಸ್":"mt","ಮಾವೋರಿ":"mi","ಮ್ಯಾಸೆಡೋನಿಯನ್":"mk","ಯುಕ್ರೇನಿಯನ್":"uk","ರಷಿಯನ್":"ru","ರೊಮೇನಿಯನ್":"ro","ಲಿಥುವೇನಿಯನ್":"lt","ಲ್ಯಾಟಿನ್":"la","ಲ್ಯಾಟ್ವಿಯನ್‌":"lv","ವಿಯೆಟ್ನಾಮಿ":"vi","ವೆಲ್ಶ್":"cy","ಸರ್ಬಿಯನ್":"sr","ಸ್ಕಾಟ್ಸ್ ಗ್ಯಾಲಿಕ್":"gd","ಸ್ಪ್ಯಾನಿಷ್":"es","ಸ್ಲೊವಾಕ್":"sk","ಸ್ಲೊವೆನಿಯನ್":"sl","ಸ್ವೀಡಿಷ್":"sv","ಹಂಗೇರಿಯನ್":"hu","ಹಯಥಿಯನ್‌ ಕ್ರಿಯೋಲ್‌":"ht","ಹಿಂದಿ":"hi","ಹೀಬ್ರೂ":"he","അമാറിക്":"am","അർമേനിയൻ":"hy","അൽബേനിയൻ":"sq","അസർബൈജാനി":"az","അറബിക്":"ar","ഇന്തോനേഷ്യൻ":"id","ഇംഗ്ലീഷ്":"en","ഇറ്റാലിയൻ":"it","ഉക്രേനിയൻ":"uk","ഉസ്ബെക്ക്":"uz","എസ്‌പെരന്തോ":"eo","എസ്റ്റോണിയൻ":"et","ഐസ്‌ലാൻഡിക്":"is","ഐറിഷ്":"ga","കന്നട":"kn","കാറ്റലൻ":"ca","കുർദ്ദിഷ്":"ku","കൊറിയൻ":"ko","ക്രൊയേഷ്യൻ":"hr","ഗലീഷ്യൻ":"gl","ഗ്രീക്ക്":"el","ചെക്ക്":"cs","ചൈനീസ് (പരമ്പരാഗതം)":"zh-tw","ചൈനീസ് (ലഘൂകരിച്ചത്)":"zh-cn","ജർമ്മൻ":"de","ജാപ്പനീസ്‌":"ja","ടർക്കിഷ്":"tr","ഡച്ച്":"nl","ഡാനിഷ്":"da","തായ്":"th","തെലുങ്ക്":"te","നോർവീജിയൻ":"nb","പേർഷ്യൻ":"fa","പോർച്ചുഗീസ്":"pt","പോളിഷ്":"pl","ഫിന്നിഷ്":"fi","ഫ്രെഞ്ച്":"fr","ബർമീസ്":"my","ബൾഗേറിയൻ":"bg","ബാസ്ക്":"eu","ബെലാറുഷ്യൻ":"be","മംഗോളിയൻ":"mn","മലയാളം":"ml","മലയ്":"ms","മറാഠി":"mr","മാസഡോണിയൻ":"mk","മാൾട്ടീസ്":"mt","മൗറി":"mi","ലാറ്റിൻ":"la","ലാറ്റ്‌വിയൻ":"lv","ലിത്വേനിയൻ":"lt","വിയറ്റ്നാമീസ്":"vi","വെൽഷ്":"cy","സുളു":"zu","സെർബിയൻ":"sr","സ്കോട്ട്സ് ഗ്യാലിക്":"gd","സ്പാനിഷ്":"es","സ്ലോവാക്":"sk","സ്ലോവേനിയൻ":"sl","സ്വീഡിഷ്":"sv","ഹംഗേറിയൻ":"hu","ഹിന്ദി":"hi","ഹീബ്രു":"he","ഹെയ്തിയൻ ക്രയോൾ":"ht","റഷ്യൻ":"ru","റൊമേനിയൻ":"ro","albánčina":"sq","amharčina":"am","arabčina":"ar","arménčina":"hy","azerbajdžančina":"az","barmčina":"my","bieloruština":"be","bulharčina":"bg","čínština (tradičná)":"zh-tw","dánčina":"da","estónčina":"et","fínčina":"fi","francúzština":"fr","galícijčina":"gl","gréčtina":"el","haitská kreolčina":"ht","hebrejčina":"he","hindčina":"hi","holandčina":"nl","chorvátčina":"hr","indonézština":"id","írčina":"ga","islandčina":"is","japončina":"ja","kannadčina":"kn","katalánčina":"ca","kórejčina":"ko","kurdčina":"ku","latinčina":"la","litovčina":"lt","macedónčina":"mk","maďarčina":"hu","malajámčina":"ml","malajčina":"ms","maltčina":"mt","maorijčina":"mi","maratčina":"mr","mongolčina":"mn","nemčina":"de","nórčina":"nb","perzština":"fa","poľština":"pl","portugalčina":"pt","rumunčina":"ro","slovenčina":"sk","slovinčina":"sl","srbčina":"sr","škótska gaelčina":"gd","španielčina":"es","švédčina":"sv","taliančina":"it","telugčina":"te","thajčina":"th","ukrajinčina":"uk","vietnamčina":"vi","waleština":"cy","zuluština":"zu","isi-albania":"sq","isi-amharic":"am","isi-arabic":"ar","isi-armenian":"hy","isi-azerbaijani":"az","isi-basque":"eu","isi-belarusian":"be","isi-bulgarian":"bg","isi-burmese":"my","isi-catalan":"ca","isi-chinese (simplified)":"zh-cn","isi-chinese (traditional)":"zh-tw","isi-croatian":"hr","isi-czech":"cs","isi-danish":"da","isi-dutch":"nl","isi-english":"en","isi-esperanto":"eo","isi-estonian":"et","isi-finnish":"fi","isi-french":"fr","isi-galician":"gl","isi-german":"de","isi-greek":"el","isi-haitian creole":"ht","isi-hangarian":"hu","isi-hebrew":"he","isi-hindi":"hi","isi-icelandic":"is","isi-indonesian":"id","isi-irish":"ga","isi-italian":"it","isi-japanese":"ja","isi-kannada":"kn","isi-korean":"ko","isi-kurdish":"ku","isi-latin":"la","isi-latvian":"lv","isi-lithuanian":"lt","isi-macedonian":"mk","isi-malay":"ms","isi-malayalam":"ml","isi-maltese":"mt","isi-maori":"mi","isi-marathi":"mr","isi-mongolian":"mn","isi-norwegian":"nb","isi-persian":"fa","isi-polish":"pl","isi-portuguese":"pt","isi-romanian":"ro","isi-russian":"ru","isi-scots gaelic":"gd","isi-serbian":"sr","isi-slovak":"sk","isi-slovenian":"sl","isi-spanish":"es","isi-swedish":"sv","isi-telugu":"te","isi-thai":"th","isi-turkish":"tr","isi-ukrainian":"uk","isi-uzbek":"uz","isi-vietnamese":"vi","isi-welsh":"cy","isizulu":"zu","albania":"sq","armenia":"hy","azerbaijan":"az","belanda":"nl","belarus":"be","bulgaria":"bg","cina (mudah)":"zh-cn","cina (tradisional)":"zh-tw","croatia":"hr","denmark":"da","estonia":"et","finland":"fi","gaelic scotland":"gd","galicia":"gl","hungary":"hu","ibrani":"he","iceland":"is","indonesia":"id","inggeris":"en","ireland":"ga","itali":"it","jepun":"ja","jerman":"de","korea":"ko","kreol haiti":"ht","kurdistan":"ku","latvia":"lv","lithuania":"lt","macedonia":"mk","malta":"mt","melayu":"ms","mongolia":"mn","myanmar":"my","norway":"nb","parsi":"fa","perancis":"fr","poland":"pl","portugis":"pt","romania":"ro","rusia":"ru","sepanyol":"es","serbia":"sr","slovenia":"sl","sweden":"sv","turki":"tr","ukraine":"uk","vietnam":"vi","wales":"cy","азербайджанский":"az","албанский":"sq","амхарский":"am","английский":"en","арабский":"ar","армянский":"hy","баскский":"eu","белорусский":"be","бирманский":"my","болгарский":"bg","валлийский":"cy","венгерский":"hu","вьетнамский":"vi","галисийский":"gl","греческий":"el","датский":"da","иврит":"he","индонезийский":"id","ирландский":"ga","исландский":"is","испанский":"es","итальянский":"it","каталанский":"ca","китайский (традиционный)":"zh-tw","китайский (упрощенный)":"zh-cn","корейский":"ko","креольский (гаити)":"ht","курманджи":"ku","латинский":"la","латышский":"lv","литовский":"lt","македонский":"mk","малайский":"ms","мальтийский":"mt","маори":"mi","монгольский":"mn","немецкий":"de","нидерландский":"nl","норвежский":"nb","персидский":"fa","польский":"pl","португальский":"pt","румынский":"ro","русский":"ru","сербский":"sr","словацкий":"sk","словенский":"sl","тайский":"th","турецкий":"tr","узбекский":"uz","украинский":"uk","финский":"fi","французский":"fr","хинди":"hi","хорватский":"hr","чешский":"cs","шведский":"sv","шотландский (гэльский)":"gd","эсперанто":"eo","эстонский":"et","японский":"ja","albański":"sq","amharski":"am","angielski":"en","arabski":"ar","azerski":"az","baskijski":"eu","białoruski":"be","birmański":"my","bułgarski":"bg","chiński (tradycyjny)":"zh-tw","chiński (uproszczony)":"zh-cn","chorwacki":"hr","czeski":"cs","duński":"da","estoński":"et","fiński":"fi","francuski":"fr","galicyjski":"gl","grecki":"el","hebrajski":"he","hiszpański":"es","indonezyjski":"id","irlandzki":"ga","islandzki":"is","japoński":"ja","kataloński":"ca","koreański":"ko","kreolski (haiti)":"ht","kurdyjski":"ku","litewski":"lt","łaciński":"la","łotewski":"lv","macedoński":"mk","malajalam":"ml","malajski":"ms","maltański":"mt","mongolski":"mn","niderlandzki":"nl","niemiecki":"de","norweski":"nb","ormiański":"hy","perski":"fa","polski":"pl","portugalski":"pt","rosyjski":"ru","rumuński":"ro","serbski":"sr","słowacki":"sk","słoweński":"sl","szkocki gaelicki":"gd","szwedzki":"sv","tajski":"th","turecki":"tr","ukraiński":"uk","uzbecki":"uz","walijski":"cy","węgierski":"hu","wietnamski":"vi","włoski":"it","азербайджанская":"az","албанская":"sq","амхарская":"am","англійская":"en","арабская":"ar","армянская":"hy","балгарская":"bg","баскская":"eu","беларуская":"be","в\'етнамская":"vi","валійская":"cy","венгерская":"hu","гаіцянская крэольская":"ht","галандская":"nl","галісійская":"gl","грэчаская":"el","дацкая":"da","інданезійская":"id","ірландская":"ga","ісландская":"is","іспанская":"es","італьянская":"it","іўрыт":"he","карэйская":"ko","каталонская":"ca","кітайская (спрошчаная)":"zh-cn","кітайская (традыцыйная)":"zh-tw","курдская (курманджы)":"ku","латышская":"lv","лацінская":"la","літоўская":"lt","м\'янманская (бірманская)":"my","маары":"mi","македонская":"mk","малайская":"ms","мальтыйская":"mt","мангольская":"mn","нарвежская":"nb","нямецкая":"de","партугальская":"pt","персідская":"fa","польская":"pl","румынская":"ro","руская":"ru","сербская":"sr","славацкая":"sk","славенская":"sl","тайская":"th","турэцкая":"tr","тэлугу":"te","узбекская":"uz","украінская":"uk","фінская":"fi","французская":"fr","харвацкая":"hr","хіндзі":"hi","чэшская":"cs","шатландская гэльская":"gd","шведская":"sv","эсперанта":"eo","эстонская":"et","японская":"ja","amarikisht":"am","anglisht":"en","arabisht":"ar","armenisht":"hy","azerisht":"az","baskisht":"eu","birmanisht":"my","bjellorusisht":"be","bullgarisht":"bg","çekisht":"cs","danisht":"da","estonisht":"et","finlandisht":"fi","frëngjisht":"fr","galicianisht":"gl","galishte skoceze":"gd","greqisht":"el","gjermanisht":"de","hebraisht":"he","hindisht":"hi","holandisht":"nl","hungarisht":"hu","indonezisht":"id","irlandisht":"ga","islandisht":"is","italisht":"it","japonisht":"ja","kanada":"kn","katalonisht":"ca","kinezisht (e thjeshtuar)":"zh-cn","kinezisht (tradicionale)":"zh-tw","koreanisht":"ko","kreolishte haitiane":"ht","kroatisht":"hr","latinisht":"la","letonisht":"lv","lituanisht":"lt","malajalamisht":"ml","malajzisht":"ms","malteze":"mt","maorisht":"mi","maqedonisht":"mk","maratisht":"mr","mongolisht":"mn","norvegjisht":"nb","persisht":"fa","polonisht":"pl","portugalisht":"pt","rumanisht":"ro","rusisht":"ru","serbisht":"sr","sllovakisht":"sk","sllovenisht":"sl","spanjisht":"es","suedisht":"sv","shqip":"sq","tajlandisht":"th","telugisht":"te","turqisht":"tr","uellsisht":"cy","ukrainisht":"uk","uzbekisht":"uz","vietnamisht":"vi","ሀንጋሪኛ":"hu","ህንድኛ":"hi","ሊትዌንኛ":"lt","ላቲንኛ":"la","ላትቪያኛ":"lv","ማላያላምኛ":"ml","ማላይኛ":"ms","ማልቲስኛ":"mt","ማራቲኛ":"mr","ማዮሪኛ":"mi","ሜቄዶኒያኛ":"mk","ሞንጎሊያኛ":"mn","ራሽያኛ":"ru","ሮማኒያንኛ":"ro","ሰርቢያኛ":"sr","ስሎቫክኛ":"sk","ስሎቬንያኛ":"sl","ስዊድንኛ":"sv","ስፓኒሽኛ":"es","በርማኛ":"my","ቡልጋሪያኛ":"bg","ባስክኛ":"eu","ቤላሩስኛ":"be","ቪትናምኛ":"vi","ቱርክኛ":"tr","ታይኛ":"th","ቴሉጉኛ":"te","ቻይንኛ   (ቀላሉ)":"zh-cn","ቻይንኛ  (ባሕላዊው)":"zh-tw","ቼክኛ":"cs","ኖርዌጅያንኛ":"nb","አልባንያኛ":"sq","አማርኛ":"am","አርመኒያኛ":"hy","አዜርባይጃንኛ":"az","አይሪሽ":"ga","አይስላንድኛ":"is","ኡዝቤክኛ":"uz","ኤስቶኒያኛ":"et","ኤስፐራንቶ":"eo","እንዶኔዢያኛ":"id","እንግሊዝኛ":"en","ኩርድሽኛ":"ku","ካታላንኛ":"ca","ካናዳኛ":"kn","ክሮኤሽያኛ":"hr","ኮሪያኛ":"ko","ዌልሽ":"cy","ዐረብኛ":"ar","ዕብራይስጥ":"he","ዙሉኛ":"zu","የሃይቲ ክረኦሌኛ":"ht","የስኮት ጌልክኛ":"gd","ዩክሬንኛ":"uk","ደችኛ":"nl","ዴንሽኛ":"da","ጀርመንኛ":"de","ጃፓንኛ":"ja","ጋሊሺያኛ":"gl","ግሪክኛ":"el","ጣሊያንኛ":"it","ፈረንሳይኛ":"fr","ፊኒሽኛ":"fi","ፐርሺያኛ":"fa","ፖሊሽኛ":"pl","ፖርቱጋሊኛ":"pt","alban":"sq","alman":"de","amarikcə":"am","azərbaycan dili":"az","bask":"eu","belarusca":"be","bolqar":"bg","çex":"cs","çin (ən\'ənəvi)":"zh-tw","çin (sadələşdirilmiş)":"zh-cn","danimarka":"da","erməni":"hy","eston":"et","ərəb":"ar","fars dili":"fa","fin":"fi","fransız":"fr","haiti kreol dili":"ht","hind":"hi","xorvat":"hr","ispan":"es","i̇ndoneziya":"id","i̇ngilis":"en","i̇rland":"ga","i̇sland":"is","i̇sveç":"sv","i̇talyan":"it","i̇vrit":"he","katalan":"ca","koreya":"ko","kürd dili (kurmanci)":"ku","qalisian":"gl","latın":"la","latış":"lv","litva":"lt","macar":"hu","makedoniya":"mk","maoricə":"mi","monqolca":"mn","myanma (birma) dili":"my","norveç":"nb","özbək":"uz","polyak":"pl","portuqal":"pt","rumın":"ro","rus":"ru","serb":"sr","sloven":"sl","şotland (kelt)":"gd","tayca":"th","teluqu":"te","türk":"tr","uels":"cy","ukrayna":"uk","vyetnam":"vi","yapon":"ja","yunan":"el","zulu dili":"zu","albaniż":"sq","amħari":"am","armen":"hy","ażerbajġani":"az","belarussu":"be","bulgaru":"bg","ċek":"cs","ċiniż (semplifikat)":"zh-cn","ċiniż (tradizzjonali)":"zh-tw","creole haiti":"ht","daniż":"da","ebrajk":"he","estonjan":"et","finlandiż":"fi","franċiż":"fr","ġappuniż":"ja","ġermaniż":"de","gaelic tal-iskoċċiżi":"gd","galizjan":"gl","grieg":"el","għarbi":"ar","ħindi":"hi","indoneżjan":"id","ingliż":"en","irlandiż":"ga","islandiż":"is","kroat":"hr","kurd (kurmanji)":"ku","latvjan":"lv","litwen":"lt","maċedonjan":"mk","malasjan":"ms","malti":"mt","marati":"mr","mjanmar (burma)":"my","mongoljan":"mn","norveġiż":"nb","olandiż":"nl","persjan":"fa","pollakk":"pl","portugiż":"pt","rumen":"ro","russu":"ru","slovakk":"sk","spanjol":"es","svediż":"sv","tajlandiż":"th","taljan":"it","tork":"tr","ukren":"uk","ungeriż":"hu","użbek":"uz","vjetnamiż":"vi","żulu":"zu","albanski":"sq","amharik":"am","arapski":"ar","armenijski":"hy","azerbajdžanski":"az","bjeloruski":"be","bugarski":"bg","burmanski":"my","češki":"cs","danski":"da","engleski":"en","estonski":"et","finski":"fi","galski":"gl","grčki":"el","haićansko-kreolski":"ht","hebrejski":"he","hindu":"hi","hrvatski":"hr","indonezijski":"id","irski":"ga","islandski":"is","japanski":"ja","katalonski":"ca","kineski (pojednost.)":"zh-cn","kineski (tradicionalni)":"zh-tw","korejski":"ko","kurdski":"ku","latinski":"la","latvijski/letonski":"lv","litvanski":"lt","mađarski":"hu","makedonski":"mk","malezijski":"ms","malteški":"mt","nizozemski":"nl","norveški":"nb","njemački":"de","perzijski":"fa","poljski":"pl","rumunjski":"ro","ruski":"ru","slovački":"sk","slovenski":"sl","srpski":"sr","škotski keltski":"gd","španjolski":"es","švedski":"sv","tajlandski":"th","talijanski":"it","turski":"tr","ukrajinski":"uk","uzbekistanski":"uz","velški":"cy","vijetnamski":"vi","آذرباﻳﺠﺎﻧﻰ":"az","آلبانیایی":"sq","آلمانی":"de","ارمنی":"hy","ازبکی":"uz","اسپانیایی":"es","اسپرانتو":"eo","استونيايی":"et","اسلواکی":"sk","اسلونیایی":"sl","اکراينی":"uk","امهری":"am","اندونزيايی":"id","انگلیسی":"en","ایتالیایی":"it","ایرلندی":"ga","ايسلندی":"is","باسکی":"eu","برمه‌ای":"my","بلاروسی":"be","بلغاری":"bg","پرتغالی":"pt","تايلندی":"th","ترکی استانبولی":"tr","تلوگو":"te","چک":"cs","چینی (ساده‌شده)":"zh-cn","چینی (سنتی)":"zh-tw","دانمارکی":"da","روسی":"ru","رومانيايی":"ro","زولو":"zu","ژاپنی":"ja","سوئدی":"sv","صربی":"sr","عبری":"he","عربی":"ar","فارسی":"fa","فرانسوی":"fr","فنلاندی":"fi","کاتالان":"ca","کانارا":"kn","کرئول هائیتی":"ht","کردی":"ku","کرواتی":"hr","کره‌ای":"ko","گالیسی":"gl","گاليک اسکاتلندی":"gd","لاتين":"la","لتونيايی":"lv","لهستانی":"pl","ليتوانيايی":"lt","مائوری":"mi","مالایالمی":"ml","مالايی":"ms","مالتی":"mt","مجاری":"hu","مراتی":"mr","مغولی":"mn","مقدونيه‌ای":"mk","نروژی":"nb","ولزی":"cy","ويتنامی":"vi","هلندی":"nl","هندی":"hi","يونانی":"el","ahepaitani":"az","airihi":"ga","amariki":"am","amēniana":"hy","arapeinia":"sq","arapi":"ar","eperānato":"eo","etōnia":"et","haina (onamata)":"zh-tw","hainamana (kua whakamāmātia)":"zh-cn","hanekeria":"hu","hapanihi":"ja","herepia":"sr","hinerangi":"fi","hīni":"hi","hiperu":"he","horowākia":"sk","horowinia":"sl","huitene":"sv","huru":"zu","ingarihi":"en","initonīhia":"id","itāriana":"it","kanata":"kn","karihia":"gl","katarāna":"ca","kereore haiti":"ht","kiriki":"el","kōreana":"ko","koroātiana":"hr","korukoru":"tr","kūrihi":"ku","makerōnia":"mk","māratihi":"mt","marei":"ms","mareiarama":"ml","mongōriana":"mn","nōwei":"nb","pākihi":"eu","pāniora":"es","pēma (purumīhi)":"my","peraruhia":"be","perēhia":"fa","pōrana":"pl","potukīhi":"pt","purukāriana":"bg","rātini":"la","rāwhiana":"lv","rituānia":"lt","romānia":"ro","rūhia":"ru","tai":"th","tati":"nl","tenemāka":"da","teruku":"te","tiamana":"de","tieke":"cs","tiorangi":"is","tuauri kotarangi":"gd","uhipeke":"uz","ūkareiana":"uk","wēra":"cy","whitināmu":"vi","wīwī":"fr","αγγλικά":"en","αζερμπαϊτζανικά":"az","αλβανικά":"sq","αμχαρικά":"am","αραβικά":"ar","αρμενικά":"hy","βασκικά":"eu","βιετναμεζικά":"vi","βιρμανικά":"my","βουλγαρικά":"bg","γαελικά σκοτίας":"gd","γαλικιακά":"gl","γαλλικά":"fr","γερμανικά":"de","δανικά":"da","εβραϊκά":"he","ελληνικά":"el","εσθονικά":"et","εσπεράντο":"eo","ζουλού":"zu","ιαπωνικά":"ja","ινδονησιακά":"id","ιρλανδικά":"ga","ισλανδικά":"is","ισπανικά":"es","ιταλικά":"it","κανάντα":"kn","καταλανικά":"ca","κινέζικα (απλοποιημένα)":"zh-cn","κινέζικα (παραδοσιακά)":"zh-tw","κορεατικά":"ko","κουρδικά":"ku","κρεόλ αϊτής":"ht","κροατικά":"hr","λατινικά":"la","λετονικά":"lv","λευκορωσικά":"be","λιθουανικά":"lt","μαλαγιάλαμ":"ml","μαλέι":"ms","μαλτεζικά":"mt","μαορί":"mi","μαραθικά":"mr","μογγολικά":"mn","νορβηγικά":"nb","ολλανδικά":"nl","ουαλικά":"cy","ουγγρικά":"hu","ουζμπεκικά":"uz","ουκρανικά":"uk","περσικά":"fa","πολωνικά":"pl","πορτογαλικά":"pt","ρουμανικά":"ro","ρωσικά":"ru","σερβικά":"sr","σλαβομακεδονικά":"mk","σλοβακικά":"sk","σλοβενικά":"sl","σουηδικά":"sv","ταϊλανδεζικά":"th","τελούγκου":"te","τούρκικα":"tr","τσεχικά":"cs","φινλανδικά":"fi","χίντι":"hi","amxar":"am","arman":"hy","bolgar":"bg","dat":"da","fors":"fa","fransuz":"fr","gaiti-kreol":"ht","galisiy":"gl","golland":"nl","grek":"el","ibroniy":"he","indonez":"id","ingliz":"en","irland":"ga","island":"is","italyan":"it","koreys":"ko","kurd (kurmonji)":"ku","latish":"lv","lotin":"la","makedon":"mk","maltiy":"mt","maratxi":"mr","mo‘g‘ul":"mn","nemis":"de","norveg":"nb","ozarbayjon":"az","portugal":"pt","rumin":"ro","tay":"th","turk":"tr","ukrain":"uk","valliy":"cy","venger":"hu","xitoy (an’anaviy)":"zh-tw","xitoy (soddalashgan)":"zh-cn","o‘zbek":"uz","shotland-gel":"gd","shved":"sv","chex":"cs","albanska":"sq","amharísku":"am","arabíska":"ar","armenska":"hy","aserska":"az","baskneska":"eu","búlgarska":"bg","búrmíska":"my","danska":"da","eistneska":"et","enska":"en","esperantó":"eo","finnska":"fi","franska":"fr","galisíska":"gl","gríska":"el","haítískt kreólamál":"ht","hebreska":"he","hindí":"hi","hollenska":"nl","hvítrússneska":"be","indónesíska":"id","írska":"ga","íslenska":"is","ítalska":"it","japanska":"ja","katalónska":"ca","kínverska (einfölduð)":"zh-cn","kínverska (hefðbundin)":"zh-tw","kóreska":"ko","króatíska":"hr","kúrdíska":"ku","latína":"la","lettneska":"lv","litháíska":"lt","makedónska":"mk","malajíska":"ms","maltneska":"mt","maoríska":"mi","maratí":"mr","mongólska":"mn","norska":"nb","persneska":"fa","portúgalska":"pt","pólska":"pl","rúmenska":"ro","rússneska":"ru","serbneska":"sr","skosk-gelíska":"gd","slóvakíska":"sk","slóvenska":"sl","spænska":"es","súlú":"zu","sænska":"sv","taílenska":"th","tékkneska":"cs","tyrkneska":"tr","ungverska":"hu","úkraínska":"uk","úsbekíska":"uz","velska":"cy","víetnamska":"vi","þýska":"de","ադրբեջաներեն":"az","ալբաներեն":"sq","ամհարերեն":"am","անգլերեն":"en","արաբերեն":"ar","բասկերեն":"eu","բելառուսերեն":"be","բիրմաներեն":"my","բուլղարերեն":"bg","գալիսերեն":"gl","գերմաներեն":"de","դանիերեն":"da","եբրայերեն":"he","զուլուսերեն":"zu","էսպերանտո":"eo","էստոներեն":"et","թայերեն":"th","թուրքերեն":"tr","ինդոնեզերեն":"id","իռլանդերեն":"ga","իսլանդերեն":"is","իսպաներեն":"es","իտալերեն":"it","լատիներեն":"la","լատվիերեն":"lv","լեհերեն":"pl","լիտվերեն":"lt","խորվաթերեն":"hr","կաննադա":"kn","կատալաներեն":"ca","կելտական շոտլանդերեն":"gd","կորեերեն":"ko","կրեոլերեն (հայիթի)":"ht","հայերեն":"hy","հինդի":"hi","հոլանդերեն":"nl","հունարեն":"el","հունգարերեն":"hu","ճապոներեն":"ja","մալայալամ":"ml","մալայերեն":"ms","մալթերեն":"mt","մակեդոներեն":"mk","մաորի":"mi","մարաթի":"mr","մոնղոլերեն":"mn","նորվեգերեն":"nb","շվեդերեն":"sv","ուզբեկերեն":"uz","ուկրաիներեն":"uk","չեխերեն":"cs","չինարեն (ավանդական)":"zh-tw","չինարեն (պարզեցված)":"zh-cn","պարսկերեն":"fa","պորտուգալերեն":"pt","ռումիներեն":"ro","ռուսերեն":"ru","սերբերեն":"sr","սլովակերեն":"sk","սլովեներեն":"sl","վալերեն":"cy","վիետնամերեն":"vi","տելուգու":"te","քրդերեն (քուրմանջի)":"ku","ֆիններեն":"fi","ֆրանսերեն":"fr","arabia":"ar","baski":"eu","burma":"my","englanti":"en","espanja":"es","haitinkreoli":"ht","heprea":"he","hollanti":"nl","iiri":"ga","islanti":"is","italia":"it","japani":"ja","katalaani":"ca","kiina (perinteinen)":"zh-tw","kiina (yksinkert.)":"zh-cn","kreikka":"el","kroatia":"hr","kurdi":"ku","kymri":"cy","liettua":"lt","makedonia":"mk","malaiji":"ms","norja":"nb","persia":"fa","portugali":"pt","puola":"pl","ranska":"fr","ruotsi":"sv","saksa":"de","skottigaeli":"gd","slovakia":"sk","suomi":"fi","tanska":"da","tsekki":"cs","turkki":"tr","ukraina":"uk","unkari":"hu","uzbekki":"uz","valkovenäjä":"be","venäjä":"ru","viro":"et","albaniera":"sq","alemana":"de","amharera":"am","arabiera":"ar","armeniera":"hy","azerbaijanera":"az","bielorrusiera":"be","birmaniera":"my","bulgariera":"bg","daniera":"da","errumaniera":"ro","errusiera":"ru","eskoziako gaelera":"gd","eslovakiera":"sk","esloveniera":"sl","esperantoa":"eo","estoniera":"et","euskara":"eu","frantsesa":"fr","gaelera":"cy","galiziera":"gl","gaztelania":"es","greziera":"el","hebreera":"he","hindia":"hi","hungariera":"hu","indonesiera":"id","ingelesa":"en","irlandera":"ga","islandiera":"is","italiera":"it","japoniera":"ja","katalana":"ca","koreera":"ko","kreolera (haiti)":"ht","kroaziera":"hr","kurduera":"ku","letoniera":"lv","lituaniera":"lt","malabarera":"ml","malaysiera":"ms","maltera":"mt","maoriera":"mi","marathera":"mr","mazedoniera":"mk","mongoliera":"mn","nederlandera":"nl","norvegiera":"nb","persiera":"fa","poloniera":"pl","portugesa":"pt","serbiera":"sr","suediera":"sv","suomiera":"fi","telugua":"te","thaiera":"th","turkiera":"tr","txekiera":"cs","txinera (soildua)":"zh-cn","txinera (tradizionala)":"zh-tw","ukrainera":"uk","uzbekera":"uz","vietnamera":"vi","zuluera":"zu","albanès":"sq","alemany":"de","amhàric":"am","anglès":"en","àrab":"ar","armeni":"hy","àzeri":"az","basc":"eu","bielorús":"be","birmà":"my","búlgar":"bg","castellà":"es","català":"ca","coreà":"ko","crioll d\'haití":"ht","croat":"hr","danès":"da","eslovac":"sk","eslovè":"sl","estonià":"et","finès":"fi","francès":"fr","gaèlic escocès":"gd","gallec":"gl","gal·lès":"cy","hebreu":"he","hongarès":"hu","indonesi":"id","irlandès":"ga","islandès":"is","italià":"it","japonès":"ja","letó":"lv","lituà":"lt","llatí":"la","macedònic":"mk","malai":"ms","malaiàlam":"ml","maltès":"mt","neerlandès":"nl","noruec":"nb","polonès":"pl","portuguès":"pt","romanès":"ro","serbi":"sr","suec":"sv","txec":"cs","ucraïnès":"uk","xinès (simplificat)":"zh-cn","xinès (tradicional)":"zh-tw","albāņu":"sq","amharu":"am","angļu":"en","arābu":"ar","armēņu":"hy","azerbaidžāņu":"az","baltkrievu":"be","basku":"eu","birmiešu":"my","bulgāru":"bg","čehu":"cs","dāņu":"da","ebreju (ivrits)":"he","franču":"fr","galisiešu":"gl","grieķu":"el","holandiešu":"nl","horvātu":"hr","igauņu":"et","indonēziešu":"id","īru":"ga","īslandiešu":"is","itāļu":"it","japāņu":"ja","katalāņu":"ca","korejiešu":"ko","kreolu (haiti)":"ht","krievu":"ru","kurdu":"ku","ķīniešu (tradicionālā)":"zh-tw","ķīniešu (vienkāršotā)":"zh-cn","latīņu":"la","latviešu":"lv","lietuviešu":"lt","maķedoniešu":"mk","malajalamiešu":"ml","malajiešu":"ms","maltiešu":"mt","maratu":"mr","mongoļu":"mn","norvēģu":"nb","persiešu":"fa","poļu":"pl","portugāļu":"pt","rumāņu":"ro","serbu":"sr","skotu gēlu":"gd","slovāku":"sk","slovēņu":"sl","somu":"fi","spāņu":"es","taju":"th","turku":"tr","ukraiņu":"uk","ungāru":"hu","uzbeku":"uz","vācu":"de","velsiešu":"cy","vjetnamiešu":"vi","zviedru":"sv","belarussia":"be","cek":"cs","china (aks. sederhana)":"zh-cn","china (aks. tradisional)":"zh-tw","finlandia":"fi","gaelig":"ga","gaelik skotlandia":"gd","galisia":"gl","inggris":"en","islan":"is","jepang":"ja","katala":"ca","lituania":"lt","polandia":"pl","prancis":"fr","rumania":"ro","swensk":"sv","yunani":"el","అజర్‌బైజాని":"az","అర్మేనియన్":"hy","అల్బేనియన్":"sq","ఆంగ్లము":"en","ఆమ్హారిక్":"am","ఆరబిక్":"ar","ఇండొనేసియన్":"id","ఇటాలియన్":"it","ఉజ్బెక్":"uz","ఎస్పెరాంటో":"eo","ఏస్టోనియన్":"et","ఐరిష్":"ga","ఐస్ లాండిక్":"is","కన్నడ":"kn","కర్డిష్":"ku","కొరియన్":"ko","క్యాటలాన్":"ca","క్రొయేషియన్":"hr","గాలిసియన్":"gl","గ్రీక్":"el","చెక్":"cs","చైనీస్ (సరళమైన)":"zh-cn","చైనీస్ (సామ్ప్రదాయమైన)":"zh-tw","జపనీస్":"ja","జర్మన్":"de","జులు":"zu","టర్కిష్":"tr","డచ్":"nl","డానిష్":"da","తెలుగు":"te","థాయ్":"th","నార్విజియన్":"nb","పర్షియన్":"fa","పోర్చుగీస్":"pt","పోలిష్":"pl","ఫిన్నిష్":"fi","ఫ్రెంచ్":"fr","బర్మీస్":"my","బల్గేరియన్":"bg","బాస్క్":"eu","బెలారుషియన్":"be","మంగోలియన్":"mn","మయోరి":"mi","మరాఠీ":"mr","మలయాళం":"ml","మాలై":"ms","మాల్టీస్":"mt","మాసిడోనియన్":"mk","యుక్రేనియన్":"uk","రష్యన్":"ru","రొమేనియన్":"ro","లాటిన్":"la","లాట్వియన్":"lv","లిథువేనియన్":"lt","వియత్నామీస్":"vi","వెల్ష్":"cy","సెర్బియన్":"sr","స్కాట్స్ గేలిక్":"gd","స్పానిష్":"es","స్లోవక్":"sk","స్లోవేనియన్":"sl","స్వీడిష్":"sv","హంగేరియన్":"hu","హిందీ":"hi","హీబ్రూ":"he","హైయేటియన్ క్రియోల్":"ht","amhárico":"am","azerí":"az","chino (simplificado)":"zh-cn","chino (tradicional)":"zh-tw","criollo haitiano":"ht","danés":"da","estonio":"et","euskera":"eu","finlandés":"fi","gallego":"gl","griego":"el","japonés":"ja","kurdo":"ku","malayo":"ms","noruego":"nb","rumano":"ro","uzbeco":"uz","albaania":"sq","amhaari":"am","araabia":"ar","armeenia":"hy","aserbaidžaani":"az","birma":"my","bulgaaria":"bg","eesti":"et","galeegi":"gl","haitikreooli":"ht","heebrea":"he","hispaania":"es","hollandi":"nl","horvaadi":"hr","indoneesia":"id","inglise":"en","islandi":"is","itaalia":"it","jaapani":"ja","kreeka":"el","ladina":"la","leedu":"lt","lihtsustatud hiina":"zh-cn","läti":"lv","makedoonia":"mk","malajalaami":"ml","maoori":"mi","mongoli":"mn","norra":"nb","poola":"pl","prantsuse":"fr","pärsia":"fa","rootsi":"sv","rumeenia":"ro","slovaki":"sk","sloveeni":"sl","soome":"fi","suulu":"zu","šoti":"gd","taani":"da","traditsiooniline hiina":"zh-tw","tšehhi":"cs","türgi":"tr","uelsi":"cy","ungari":"hu","usbeki":"uz","valgevene":"be","vene":"ru","albanyen":"sq","amenyen":"hy","anglè":"en","azèbajani":"az","belarisyen":"be","bilgaryen":"bg","chinwa (senp)":"zh-cn","chinwa (tradisyonèl)":"zh-tw","danwa":"da","ebre":"he","endonezyen":"id","endou":"hi","estonyen":"et","fenlandè":"fi","franse":"fr","gaelik ekosè":"gd","galisyen":"gl","grèk":"el","ikrenyen":"uk","ilandè":"ga","islandè":"is","italyen":"it","izbèk":"uz","japonè":"ja","koreyen":"ko","kreyòl ayisyen":"ht","kurde (kurmandji)":"ku","kwoasyen":"hr","laten":"la","letonyen":"lv","lityanyen":"lt","malè":"ms","malt":"mt","masedonyen":"mk","mongolyen":"mn","myanma (burmese)":"my","nòvejyen":"nb","olandè, neyèlandè":"nl","onngaryen":"hu","panyòl":"es","pèsyen":"fa","polonè":"pl","pòtigè":"pt","ris":"ru","romanyen":"ro","sèb":"sr","slovenyen":"sl","syedwa":"sv","tuk":"tr","tyèk":"cs","vyetnamyen":"vi","albaneg":"sq","almaeneg":"de","arabeg":"ar","armeneg":"hy","aserbaijaneg":"az","basgeg":"eu","belarwseg":"be","bwlgaraidd":"bg","catalaneg":"ca","creol haiti":"ht","croateg":"hr","cymraeg":"cy","cyrdeg (kurmandji)":"ku","daneg":"da","eidaleg":"it","estoneg":"et","fietnameg":"vi","ffineg":"fi","fflemeg":"nl","ffrangeg":"fr","gaeleg yr alban":"gd","galisaidd":"gl","groeg":"el","gwyddeleg":"ga","hebraeg":"he","hwngareg":"hu","iaith corea":"ko","indonesieg":"id","islandeg":"is","iwcraineg":"uk","japaneg":"ja","latfieg":"lv","lithwaneg":"lt","lladin":"la","macedoneg":"mk","malteseg":"mt","mongoleg":"mn","myanmar (byrma)":"my","norwyeg":"nb","perseg":"fa","portiwgaleg":"pt","pwyleg":"pl","rwmaneg":"ro","rwsieg":"ru","saesneg":"en","sbaeneg":"es","serbeg":"sr","slofac":"sk","slofenia":"sl","swedeg":"sv","swlw":"zu","tsieceg":"cs","tsieineeg (traddodiadol)":"zh-tw","tsieineeg (wedi symleiddio)":"zh-cn","twrceg":"tr","usbec":"uz","अंग्रेज़ी":"en","अज़रबैजानी":"az","अल्बेनियन":"sq","आइसलैंडिक":"is","आर्मेनियन":"hy","इटैलियन":"it","उज़्बेक":"uz","एस्तोनियन":"et","एस्पेरांटो":"eo","ऐम्हेरिक":"am","कन्नड़":"kn","कुर्दिश (करमंजी)":"ku","कैटेलन":"ca","गैलिशियन":"gl","चीनी (परंपरागत)":"zh-tw","चेक":"cs","जापानी":"ja","ज़ुलु":"zu","डैनिश":"da","तुर्क":"tr","तेलुगु":"te","पुर्तगाली":"pt","फ़िनिश":"fi","फ़्रेंच":"fr","बर्मी":"my","बुल्गारियन":"bg","बेलारूसीयन":"be","बैस्क":"eu","मलयालम":"ml","माऔरी":"mi","माल्टी":"mt","मेसीडोनियन":"mk","यूक्रेनियन":"uk","रूसी":"ru","रोमेनियन":"ro","लातवियन":"lv","लैटिन":"la","वियतनामी":"vi","सर्बियाई":"sr","स्पैनिश":"es","स्लोवाक":"sk","स्लोवेनियन":"sl","हंगरियन":"hu","हीब्रू":"he","हैतियन क्रिओल":"ht","阿尔巴尼亚语":"sq","阿拉伯语":"ar","阿姆哈拉语":"am","阿塞拜疆语":"az","爱尔兰语":"ga","爱沙尼亚语":"et","巴斯克语":"eu","白俄罗斯语":"be","保加利亚语":"bg","冰岛语":"is","波兰语":"pl","波斯语":"fa","丹麦语":"da","德语":"de","俄语":"ru","法语":"fr","芬兰语":"fi","海地克里奥尔语":"ht","韩语":"ko","荷兰语":"nl","加利西亚语":"gl","加泰罗尼亚语":"ca","捷克语":"cs","卡纳达语":"kn","克罗地亚语":"hr","库尔德语":"ku","拉丁语":"la","拉脱维亚语":"lv","立陶宛语":"lt","罗马尼亚语":"ro","马耳他语":"mt","马拉地语":"mr","马拉雅拉姆语":"ml","马来语":"ms","马其顿语":"mk","毛利语":"mi","蒙古语":"mn","缅甸语":"my","南非祖鲁语":"zu","挪威语":"nb","葡萄牙语":"pt","日语":"ja","瑞典语":"sv","塞尔维亚语":"sr","世界语":"eo","斯洛伐克语":"sk","斯洛文尼亚语":"sl","苏格兰盖尔语":"gd","泰卢固语":"te","泰语":"th","土耳其语":"tr","威尔士语":"cy","乌克兰语":"uk","乌兹别克语":"uz","西班牙语":"es","希伯来语":"he","希腊语":"el","匈牙利语":"hu","亚美尼亚语":"hy","意大利语":"it","印地语":"hi","印尼语":"id","英语":"en","越南语":"vi","中文(繁体)":"zh-tw","中文(简体)":"zh-cn","азербайджански":"az","английски":"en","арабски":"ar","арменски":"hy","баски":"eu","беларуски":"be","бирмански":"my","български":"bg","галисийски":"gl","гръцки":"el","датски":"da","индонезийски":"id","ирландски":"ga","испански":"es","италиански":"it","китайски (опростен)":"zh-cn","китайски (традиционен)":"zh-tw","корейски":"ko","кюрдски":"ku","латвийски":"lv","литовски":"lt","малайски":"ms","малтийски":"mt","немски":"de","нидерландски":"nl","норвежки":"nb","персийски":"fa","румънски":"ro","словашки":"sk","словенски":"sl","сръбски":"sr","тайландски":"th","уелски":"cy","узбекски":"uz","финландски":"fi","френски":"fr","хаитянски креолски":"ht","хърватски":"hr","шотландски келтски":"gd","японски":"ja","الآيسلندية":"is","الأذرية":"az","الارمنية":"hy","الإسبانية":"es","الاسبرانتو":"eo","الإستونية":"et","الاسكتلندية الغالية":"gd","الألبانية":"sq","الألمانية":"de","الأمهرية":"am","الإنجليزية":"en","الإندونيسية":"id","الأوزبكية":"uz","الأوكرانية":"uk","الأيرلندية":"ga","الإيطالية":"it","الباسكية":"eu","البرتغالية":"pt","البلغارية":"bg","البورمية":"my","البولندية":"pl","البيلاروسية":"be","التايلاندية":"th","التركية":"tr","التشيكية":"cs","التيلوجو":"te","الجاليكية":"gl","الدانماركية":"da","الروسية":"ru","الرومانية":"ro","الزولوية":"zu","السلوفاكية":"sk","السلوفينية":"sl","السويدية":"sv","الصربية":"sr","الصينية (التقليدية)":"zh-tw","الصينية (المبسطة)":"zh-cn","العبرية":"he","العربية":"ar","الفارسية":"fa","الفرنسية":"fr","الفنلندية":"fi","الفيتنامية":"vi","القطلونية":"ca","الكانادا":"kn","الكردية":"ku","الكرواتية":"hr","الكورية":"ko","اللاتفية":"lv","اللاتينية":"la","اللغة الكريولية الهايتية":"ht","الليتوانية":"lt","المالايالامية":"ml","المالطيّة":"mt","الماورية":"mi","المقدونية":"mk","الملايو":"ms","المنغولية":"mn","المهراتية":"mr","النرويجية":"nb","الهندية":"hi","الهنغارية":"hu","الهولندية":"nl","الويلزية":"cy","اليابانية":"ja","اليونانية":"el","баскијски":"eu","вијетнамски":"vi","галски":"gl","енглески":"en","индонежански":"id","јапански":"ja","јерменски":"hy","кинески (поједностављени)":"zh-cn","кинески (традиционални)":"zh-tw","креолски (хаити)":"ht","летонски":"lv","мађарски":"hu","марати":"mr","немачки":"de","персијски":"fa","пољски":"pl","румунски":"ro","словеначки":"sl","тајски":"th","украјински":"uk","азербайжан":"az","албани":"sq","амхарик":"am","англи":"en","араб":"ar","армени":"hy","баск":"eu","беларусь":"be","бирм":"my","болгар":"bg","вьетнам":"vi","гаити креол":"ht","галик":"gl","гаэл":"gd","герман":"de","голланд":"nl","грек":"el","дани":"da","индонези":"id","ирланд":"ga","исланд":"is","испани":"es","итали":"it","каталан":"ca","кипр":"he","курд":"ku","латви":"lv","латин":"la","литва":"lt","македон":"mk","малай":"ms","малайлам":"ml","малти":"mt","монгол":"mn","норвеги":"nb","орос":"ru","перс":"fa","польш":"pl","португаль":"pt","румын":"ro","серби":"sr","словак":"sk","словени":"sl","солонгос":"ko","тай":"th","турк":"tr","тэлүгү":"te","узбек":"uz","украин":"uk","унгар":"hu","уэльс":"cy","финлянд":"fi","франц":"fr","хорват":"hr","хятад (ердийн)":"zh-cn","хятад (уламжлалт)":"zh-tw","чех":"cs","швед":"sv","эстони":"et","япон":"ja","amhariska":"am","arabiska":"ar","armeniska":"hy","azerbajdzjanska":"az","baskiska":"eu","bulgariska":"bg","burmesiska":"my","engelska":"en","estniska":"et","finska":"fi","gaeliska":"gd","galiciska":"gl","grekiska":"el","haitiska":"ht","hebreiska":"he","indonesiska":"id","irländska":"ga","isländska":"is","italienska":"it","kanaresiska":"kn","katalanska":"ca","kinesiska (förenklad)":"zh-cn","kinesiska (traditionell)":"zh-tw","koreanska":"ko","kroatiska":"hr","kurdiska":"ku","lettiska":"lv","litauiska":"lt","makedonska":"mk","malaysiska":"ms","maltesiska":"mt","mongoliska":"mn","nederländska":"nl","persiska":"fa","polska":"pl","portugisiska":"pt","rumänska":"ro","ryska":"ru","serbiska":"sr","slovakiska":"sk","slovenska":"sl","spanska":"es","svenska":"sv","thailändska":"th","tjeckiska":"cs","turkiska":"tr","tyska":"de","ukrainska":"uk","ungerska":"hu","uzbekiska":"uz","vietnamesiska":"vi","vitryska":"be","walesiska":"cy","albaneză":"sq","amharică":"am","arabă":"ar","armeană":"hy","azerbaidjană":"az","bască":"eu","bielorusă":"be","birmană":"my","bulgară":"bg","catalană":"ca","cehă":"cs","chineză (simplificată)":"zh-cn","chineză (tradițională)":"zh-tw","coreeană":"ko","creolă haitiană":"ht","croată":"hr","daneză":"da","ebraică":"he","engleză":"en","estonă":"et","finlandeză":"fi","franceză":"fr","galeză":"cy","galica scoțiană":"gd","galiciană":"gl","germană":"de","greacă":"el","indoneziană":"id","irlandeză":"ga","islandeză":"is","italiană":"it","japoneză":"ja","kurdă":"ku","latină":"la","letonă":"lv","lituaniană":"lt","macedoneană":"mk","maghiară":"hu","malaeză":"ms","malteză":"mt","mongolă":"mn","neerlandeză":"nl","norvegiană":"nb","persană":"fa","poloneză":"pl","portugheză":"pt","română":"ro","rusă":"ru","sârbă":"sr","slovacă":"sk","slovenă":"sl","spaniolă":"es","suedeză":"sv","thailandeză":"th","turcă":"tr","ucraineană":"uk","uzbecă":"uz","vietnameză":"vi","airių":"ga","albanų":"sq","amharų":"am","anglų":"en","arabų":"ar","armėnų":"hy","azerbaidžaniečių":"az","baltarusių":"be","baskų":"eu","birmiečių":"my","bulgarų":"bg","čekų":"cs","danų":"da","estų":"et","galisų":"gl","graikų":"el","haičio kreolų":"ht","hebrajų":"he","indoneziečių":"id","islandų":"is","ispanų":"es","italų":"it","japonų":"ja","kanadų":"kn","kataloniečių":"ca","kinų (supaprastinta)":"zh-cn","kinų (tradicinė)":"zh-tw","korėjiečių":"ko","kroatų":"hr","kurdų":"ku","latvių":"lv","lenkų":"pl","lietuvių":"lt","lotynų":"la","makedoniečių":"mk","malajalių":"ml","malajiečių":"ms","maltiečių":"mt","maorių":"mi","maratų":"mr","mongolų":"mn","norvegų":"nb","olandų":"nl","persų":"fa","portugalų":"pt","prancūzų":"fr","rumunų":"ro","rusų":"ru","serbų":"sr","slovakų":"sk","slovėnų":"sl","suomių":"fi","škotų (gėlų)":"gd","švedų":"sv","tajų":"th","telugų":"te","turkų":"tr","ukrainiečių":"uk","uzbekų":"uz","valų":"cy","vengrų":"hu","vietnamiečių":"vi","vokiečių":"de","zulusų":"zu","갈리시아어":"gl","그리스어":"el","네덜란드어":"nl","노르웨이어":"nb","덴마크어":"da","독일어":"de","라트비아어":"lv","라틴어":"la","러시아어":"ru","루마니아어":"ro","리투아니아어":"lt","마라티어":"mr","마오리어":"mi","마케도니아어":"mk","말라얄람어":"ml","말레이어":"ms","몰타어":"mt","몽골어":"mn","미얀마어 (버마어)":"my","바스크어":"eu","베트남어":"vi","벨라루스어":"be","불가리아어":"bg","세르비아어":"sr","스웨덴어":"sv","스코틀랜드 게일어":"gd","스페인어":"es","슬로바키아어":"sk","슬로베니아어":"sl","아랍어":"ar","아르메니아어":"hy","아이슬란드어":"is","아이티 크리올어":"ht","아일랜드어":"ga","아제르바이잔어":"az","알바니아어":"sq","암하라어":"am","에스토니아어":"et","에스페란토어":"eo","영어":"en","우즈베크어":"uz","우크라이나어":"uk","웨일즈어":"cy","이탈리아어":"it","인도네시아어":"id","일본어":"ja","줄루어":"zu","중국어(간체)":"zh-cn","중국어(번체)":"zh-tw","체코어":"cs","카탈로니아어":"ca","칸나다어":"kn","쿠르드어":"ku","크로아티아어":"hr","태국어":"th","터키어":"tr","텔루구어":"te","페르시아어":"fa","포르투갈어":"pt","폴란드어":"pl","프랑스어":"fr","핀란드어":"fi","한국어":"ko","헝가리어":"hu","히브리어":"he","힌디어":"hi","albanese":"sq","amarico":"am","arabo":"ar","armeno":"hy","azero":"az","bielorusso":"be","bulgaro":"bg","catalano":"ca","ceco":"cs","cinese (semplificato)":"zh-cn","cinese (tradizionale)":"zh-tw","creolo haitiano":"ht","croato":"hr","curdo (kurmanji)":"ku","danese":"da","ebraico":"he","estone":"et","finlandese":"fi","francese":"fr","gaelico scozzese":"gd","galiziano":"gl","gallese":"cy","giapponese":"ja","greco":"el","indonesiano":"id","inglese":"en","irlandese":"ga","islandese":"is","latino":"la","lettone":"lv","macedone":"mk","malese":"ms","mongolo":"mn","norvegese":"nb","olandese":"nl","persiano":"fa","polacco":"pl","portoghese":"pt","rumeno":"ro","serbo":"sr","slovacco":"sk","sloveno":"sl","spagnolo":"es","svedese":"sv","tailandese":"th","tedesco":"de","ucraino":"uk","ungherese":"hu","quốc tế ngữ":"eo","tiếng ả rập":"ar","tiếng albania":"sq","tiếng amharic":"am","tiếng anh":"en","tiếng armenia":"hy","tiếng azerbaijan":"az","tiếng ba lan":"pl","tiếng ba tư":"fa","tiếng basque":"eu","tiếng belarus":"be","tiếng bồ đào nha":"pt","tiếng bulgaria":"bg","tiếng catalan":"ca","tiếng creole ở haiti":"ht","tiếng croatia":"hr","tiếng do thái":"he","tiếng đan mạch":"da","tiếng đức":"de","tiếng estonia":"et","tiếng gael scotland":"gd","tiếng galicia":"gl","tiếng hà lan":"nl","tiếng hàn":"ko","tiếng hindi":"hi","tiếng hungary":"hu","tiếng hy lạp":"el","tiếng iceland":"is","tiếng indonesia":"id","tiếng ireland":"ga","tiếng kannada":"kn","tiếng kurd":"ku","tiếng latinh":"la","tiếng latvia":"lv","tiếng litva":"lt","tiếng mã lai":"ms","tiếng macedonia":"mk","tiếng malayalam":"ml","tiếng malta":"mt","tiếng maori":"mi","tiếng marathi":"mr","tiếng mông cổ":"mn","tiếng myanmar":"my","tiếng na uy":"nb","tiếng nga":"ru","tiếng nhật":"ja","tiếng pháp":"fr","tiếng phần lan":"fi","tiếng rumani":"ro","tiếng séc":"cs","tiếng serbia":"sr","tiếng slovak":"sk","tiếng slovenia":"sl","tiếng tây ban nha":"es","tiếng telugu":"te","tiếng thái":"th","tiếng thổ nhĩ kỳ":"tr","tiếng thụy điển":"sv","tiếng trung (giản thể)":"zh-cn","tiếng trung (phồn thể)":"zh-tw","tiếng ukraina":"uk","tiếng uzbek":"uz","tiếng việt":"vi","tiếng xứ wales":"cy","tiếng ý":"it","tiếng zulu":"zu","にほんご":"ja"},"scratchToGoogleMap":{"zh-cn":"zh","nb":"no","he":"iw","es-419":"es","pt-br":"pt","ja-hira":"ja"},"previouslySupported":["ab","ms","be","eo","hy","hi","kn","ht","ku","la","mk","ml","mt","mr","mn","my","nn","sq","te","uz"]}')},function(t,e,n){"use strict";n.r(e),n.d(e,"_parse",(function(){return r})),n.d(e,"parse",(function(){return i})),n.d(e,"stringify",(function(){return s}));const r=t=>{let e=0;const n=n=>{const{line:r,column:i}=(()=>{let n=0,r=0;for(let i=0;i<e;i++)"\n"===t[i]?(n++,r=0):r++;return{line:n+1,column:r+1}})();throw new SyntaxError(`${n} (Line ${r} Column ${i})`)},r=e=>(e>=t.length&&n("Unexpected end of input"),t[e]),i=()=>r(e),s=()=>{e++},o=t=>{i()!==t&&n(`Expected '${t}' but found '${i()}'`),s()},a=(n=1,i=1)=>{if(e+i+n>t.length)return"";if(1===n)return r(e+i);let s="";for(let t=0;t<n;t++)s+=r(e+i+t);return s},c=()=>{for(;;)if(/\s/.test(i()))s();else{const t=a(2,0);if("//"===t)for(s(),s();"\n"!==i();)s();else{if("/*"!==t)break;for(s(),s();"*/"!==a(2,0);)s();s(),s()}}},u=()=>{c();switch(i()){case'"':return d();case"{":return f();case"[":return p();case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":return h();default:return l()}},l=()=>{if("null"===a(4,0)){for(let t=0;t<4;t++)s();return null}if("true"===a(4,0)){for(let t=0;t<4;t++)s();return!0}if("false"===a(5,0)){for(let t=0;t<5;t++)s();return!1}if("Infinity"===a(8,0)){for(let t=0;t<8;t++)s();return 1/0}if("NaN"===a(3,0)){for(let t=0;t<3;t++)s();return NaN}n(`Unexpected character '${i()}'`)},h=()=>{if("-Infinity"===a(9,0)){for(let t=0;t<9;t++)s();return-1/0}let t="";for(;t+=i(),/[\d.e+-]/i.test(a());)s();s();const e=+t;return Number.isNaN(e)&&n(`Not a number: ${t}`),e},d=()=>{o('"');let t="";for(;;){const e=i();if('"'===e)break;if("\\"===e)switch(s(),i()){case'"':t+='"';break;case"/":t+="/";break;case"\\":t+="\\";break;case"b":t+="\b";break;case"f":t+="\f";break;case"n":t+="\n";break;case"r":t+="\r";break;case"t":t+="\t";break;case"u":{let e="";for(let t=0;t<4;t++){s();const t=i();/[0-9a-f]/i.test(t)||n(`Invalid hex code: ${t}`),e+=t}const r=Number.parseInt(e,16);t+=String.fromCharCode(r);break}default:n(`Invalid escape code: \\${i()}`)}else t+=e;s()}return o('"'),t},p=()=>{o("["),c();const t=[];for(;c(),"]"!==i();){const e=u();if(t.push(e),c(),","!==i())break;s()}return o("]"),t},f=()=>{o("{"),c();const t={};for(;c(),"}"!==i();){const e=d();c(),o(":");const n=u();if(t[e]=n,c(),","!==i())break;s()}return o("}"),t};return u()},i=t=>{try{return JSON.parse(t)}catch(e){try{return r(t)}catch(t){throw e}}},s=t=>{if("string"==typeof t)return JSON.stringify(t);if("number"==typeof t||"boolean"==typeof t)return t.toString();if(null==t||"symbol"==typeof t)return"null";if(Array.isArray(t))return`[${t.map((t=>s(t))).join(",")}]`;if("object"==typeof t){let e="{",n=!0;const r=Object.keys(t);for(let i=0;i<r.length;i++){const o=r[i],a=t[o];void 0!==a&&(n||(e+=","),e+=`${JSON.stringify(o)}:${s(a)}`,n=!1)}return e+="}",e}if("bigint"==typeof t)throw new TypeError("Can not stringify bigint");throw new TypeError(`Can not stringify: ${t}`)}},function(t,e,n){const r=n(62),i=n(183),s=function(t){const e=Object.create(null);e.tagName=t.name,e.children=[];for(const n in t.attribs)"xmlns"!==n&&(e[n]=i(t.attribs[n]),"blockinfo"===n&&(e.blockInfo=JSON.parse(e.blockinfo),delete e.blockinfo));for(let n=0;n<t.children.length;n++)e.children.push(s(t.children[n]));return e};t.exports=function(t){let e;return e="object"==typeof t?t:r.parseDOM(t)[0],s(e)}},function(t,e){t.exports={}},function(t,e,n){e.getCached=function(){throw new Error("blocks.js has not initialized BlocksExecuteCache")},n(15)},function(t,e,n){e.getScripts=function(){throw new Error("blocks.js has not initialized BlocksRuntimeCache")},e._RuntimeScriptCache=class{constructor(t,e){this.container=t,this.blockId=e;const n=t.getBlock(e),r=t.getFields(n);if(this.fieldsOfInputs=Object.assign({},r),0===Object.keys(r).length){const e=t.getInputs(n);for(const n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const r=e[n].block,i=t.getBlock(r),s=t.getFields(i);Object.assign(this.fieldsOfInputs,s)}}for(const t in this.fieldsOfInputs){const e=this.fieldsOfInputs[t]=Object.assign({},this.fieldsOfInputs[t]);e.value.toUpperCase&&(e.value=e.value.toUpperCase())}}},n(15)},function(t,e){t.exports={IntermediateScript:class{constructor(){this.topBlockId=null,this.stack=null,this.isProcedure=!1,this.procedureVariant="",this.procedureCode="",this.arguments=[],this.isWarp=!1,this.yields=!0,this.warpTimer=!1,this.dependedProcedures=[],this.cachedCompileResult=null,this.executableHat=!1}},IntermediateRepresentation:class{constructor(){this.entry=null,this.procedures={}}}}},function(t,e,n){const r=n(0),i=n(1),s=n(2),o=n(188),a=n(43),c=n(190),{IntermediateScript:u,IntermediateRepresentation:l}=n(65),h=t=>("string"!=typeof t&&(r.warn("sanitize got unexpected type: ".concat(typeof t)),t=""+t),JSON.stringify(t).slice(1,-1)),d="runtime.ext_pen",p="".concat(d,"._getPenState(target)"),f=new o("factory"),m=new o("fun"),g=new o("gen");class b{constructor(t,e){if("number"!=typeof e)throw new Error("type is invalid");this.source=t,this.type=e}asNumber(){return 1===this.type?this.source:5===this.type?"(".concat(this.source," || 0)"):"(+".concat(this.source," || 0)")}asNumberOrNaN(){return 1===this.type||5===this.type?this.source:"(+".concat(this.source,")")}asString(){return 2===this.type?this.source:'("" + '.concat(this.source,")")}asBoolean(){return 3===this.type?this.source:"toBoolean(".concat(this.source,")")}asColor(){return this.asUnknown()}asUnknown(){return this.source}asSafe(){return this.asUnknown()}isAlwaysNumber(){return 1===this.type}isAlwaysNumberOrNaN(){return 1===this.type||5===this.type}isNeverNumber(){return!1}}class y{constructor(t,e){this.constantValue=t,this.safe=e}asNumber(){const t=+this.constantValue;return t?t.toString():Object.is(t,-0)?"-0":"0"}asNumberOrNaN(){return this.asNumber()}asString(){return'"'.concat(h(""+this.constantValue),'"')}asBoolean(){return i.toBoolean(this.constantValue).toString()}asColor(){if(/^#[0-9a-f]{6,8}$/i.test(this.constantValue)){const t=this.constantValue.substr(1);return Number.parseInt(t,16).toString()}return this.asUnknown()}asUnknown(){if("number"==typeof this.constantValue)return this.constantValue;return(+this.constantValue).toString()===this.constantValue?this.constantValue:this.asString()}asSafe(){return this.safe?this.asUnknown():this.asString()}isAlwaysNumber(){const t=+this.constantValue;return!Number.isNaN(t)&&(0!==t||""!==this.constantValue.toString().trim())}isAlwaysNumberOrNaN(){return this.isAlwaysNumber()}isNeverNumber(){return Number.isNaN(+this.constantValue)}}class v{constructor(t){this.source=t,this.type=4,this._value=null}setInput(t){if(t instanceof v){if(!t._value)return this.type=4,void(this._value=null);t=t._value}this._value=t,this.type=t instanceof b?t.type:4}asNumber(){return 1===this.type?this.source:5===this.type?"(".concat(this.source," || 0)"):"(+".concat(this.source," || 0)")}asNumberOrNaN(){return 1===this.type||5===this.type?this.source:"(+".concat(this.source,")")}asString(){return 2===this.type?this.source:'("" + '.concat(this.source,")")}asBoolean(){return 3===this.type?this.source:"toBoolean(".concat(this.source,")")}asColor(){return this.asUnknown()}asUnknown(){return this.source}asSafe(){return this.asUnknown()}isAlwaysNumber(){return!!this._value&&this._value.isAlwaysNumber()}isAlwaysNumberOrNaN(){return!!this._value&&this._value.isAlwaysNumberOrNaN()}isNeverNumber(){return!!this._value&&this._value.isNeverNumber()}}const w=t=>{const e=+t.constantValue;return!!e&&e.toString()===t.constantValue.toString()};class T{constructor(t){this.isLoop=t,this.isLastBlock=!1}}class E{constructor(t,e,n){this.script=t,this.ir=e,this.target=n,this.source="",this.variableInputs={},this.isWarp=t.isWarp,this.isProcedure=t.isProcedure,this.warpTimer=t.warpTimer,this.frames=[],this.currentFrame=null,this.namesOfCostumesAndSounds=(t=>{const e=new Set;for(const n of t.targets)if(n.isOriginal){const t=n.sprite;for(const n of t.costumes)e.add(n.name);for(const n of t.sounds)e.add(n.name)}return e})(n.runtime),this.localVariables=new o("a"),this._setupVariablesPool=new o("b"),this._setupVariables={},this.descendedIntoModulo=!1,this.isInHat=!1,this.debug=this.target.runtime.debug}pushFrame(t){this.frames.push(t),this.currentFrame=t}popFrame(){this.frames.pop(),this.currentFrame=this.frames[this.frames.length-1]}isLastBlockInLoop(){for(let t=this.frames.length-1;t>=0;t--){const e=this.frames[t];if(!e.isLastBlock)return!1;if(e.isLoop)return!0}return!1}descendInput(t){switch(t.kind){case"addons.call":return new b("(".concat(this.descendAddonCall(t),")"),4);case"compat":return new b("(".concat(this.generateCompatibilityLayerCall(t,!1),")"),4);case"constant":return this.safeConstantInput(t.value);case"counter.get":return new b("runtime.ext_scratch3_control._counter",1);case"keyboard.pressed":return new b("runtime.ioDevices.keyboard.getKeyIsDown(".concat(this.descendInput(t.key).asSafe(),")"),3);case"list.contains":return new b("listContains(".concat(this.referenceVariable(t.list),", ").concat(this.descendInput(t.item).asUnknown(),")"),3);case"list.contents":return new b("listContents(".concat(this.referenceVariable(t.list),")"),2);case"list.get":{const e=this.descendInput(t.index);if(c.supportsNullishCoalescing){if(e.isAlwaysNumberOrNaN())return new b("(".concat(this.referenceVariable(t.list),".value[(").concat(e.asNumber(),' | 0) - 1] ?? "")'),4);if(e instanceof y&&"last"===e.constantValue)return new b("(".concat(this.referenceVariable(t.list),".value[").concat(this.referenceVariable(t.list),'.value.length - 1] ?? "")'),4)}return new b("listGet(".concat(this.referenceVariable(t.list),".value, ").concat(e.asUnknown(),")"),4)}case"list.indexOf":return new b("listIndexOf(".concat(this.referenceVariable(t.list),", ").concat(this.descendInput(t.item).asUnknown(),")"),1);case"list.length":return new b("".concat(this.referenceVariable(t.list),".value.length"),1);case"looks.size":return new b("Math.round(target.size)",1);case"looks.backdropName":return new b("stage.getCostumes()[stage.currentCostume].name",2);case"looks.backdropNumber":return new b("(stage.currentCostume + 1)",1);case"looks.costumeName":return new b("target.getCostumes()[target.currentCostume].name",2);case"looks.costumeNumber":return new b("(target.currentCostume + 1)",1);case"motion.direction":return new b("target.direction",1);case"motion.x":return new b("limitPrecision(target.x)",1);case"motion.y":return new b("limitPrecision(target.y)",1);case"mouse.down":return new b("runtime.ioDevices.mouse.getIsDown()",3);case"mouse.x":return new b("runtime.ioDevices.mouse.getScratchX()",1);case"mouse.y":return new b("runtime.ioDevices.mouse.getScratchY()",1);case"noop":return new b('""',2);case"op.abs":return new b("Math.abs(".concat(this.descendInput(t.value).asNumber(),")"),1);case"op.acos":return new b("((Math.acos(".concat(this.descendInput(t.value).asNumber(),") * 180) / Math.PI)"),5);case"op.add":return new b("(".concat(this.descendInput(t.left).asNumber()," + ").concat(this.descendInput(t.right).asNumber(),")"),5);case"op.and":return new b("(".concat(this.descendInput(t.left).asBoolean()," && ").concat(this.descendInput(t.right).asBoolean(),")"),3);case"op.asin":return new b("((Math.asin(".concat(this.descendInput(t.value).asNumber(),") * 180) / Math.PI)"),5);case"op.atan":return new b("((Math.atan(".concat(this.descendInput(t.value).asNumber(),") * 180) / Math.PI)"),1);case"op.ceiling":return new b("Math.ceil(".concat(this.descendInput(t.value).asNumber(),")"),1);case"op.contains":return new b("(".concat(this.descendInput(t.string).asString(),".toLowerCase().indexOf(").concat(this.descendInput(t.contains).asString(),".toLowerCase()) !== -1)"),3);case"op.cos":return new b("(Math.round(Math.cos((Math.PI * ".concat(this.descendInput(t.value).asNumber(),") / 180) * 1e10) / 1e10)"),5);case"op.divide":return new b("(".concat(this.descendInput(t.left).asNumber()," / ").concat(this.descendInput(t.right).asNumber(),")"),5);case"op.equals":{const e=this.descendInput(t.left),n=this.descendInput(t.right);if(e.isNeverNumber()||n.isNeverNumber())return new b("(".concat(e.asString(),".toLowerCase() === ").concat(n.asString(),".toLowerCase())"),3);const r=e.isAlwaysNumber(),i=n.isAlwaysNumber();return r&&i||(r&&e instanceof y&&w(e)||i&&n instanceof y&&w(n))?new b("(".concat(e.asNumber()," === ").concat(n.asNumber(),")"),3):new b("compareEqual(".concat(e.asUnknown(),", ").concat(n.asUnknown(),")"),3)}case"op.e^":return new b("Math.exp(".concat(this.descendInput(t.value).asNumber(),")"),1);case"op.floor":return new b("Math.floor(".concat(this.descendInput(t.value).asNumber(),")"),1);case"op.greater":{const e=this.descendInput(t.left),n=this.descendInput(t.right);return e.isAlwaysNumber()&&n.isAlwaysNumberOrNaN()?new b("(".concat(e.asNumber()," > ").concat(n.asNumberOrNaN(),")"),3):e.isAlwaysNumberOrNaN()&&n.isAlwaysNumber()?new b("!(".concat(e.asNumberOrNaN()," <= ").concat(n.asNumber(),")"),3):e.isNeverNumber()||n.isNeverNumber()?new b("(".concat(e.asString(),".toLowerCase() > ").concat(n.asString(),".toLowerCase())"),3):new b("compareGreaterThan(".concat(e.asUnknown(),", ").concat(n.asUnknown(),")"),3)}case"op.join":return new b("(".concat(this.descendInput(t.left).asString()," + ").concat(this.descendInput(t.right).asString(),")"),2);case"op.length":return new b("".concat(this.descendInput(t.string).asString(),".length"),1);case"op.less":{const e=this.descendInput(t.left),n=this.descendInput(t.right);return e.isAlwaysNumberOrNaN()&&n.isAlwaysNumber()?new b("(".concat(e.asNumberOrNaN()," < ").concat(n.asNumber(),")"),3):e.isAlwaysNumber()&&n.isAlwaysNumberOrNaN()?new b("!(".concat(e.asNumber()," >= ").concat(n.asNumberOrNaN(),")"),3):e.isNeverNumber()||n.isNeverNumber()?new b("(".concat(e.asString(),".toLowerCase() < ").concat(n.asString(),".toLowerCase())"),3):new b("compareLessThan(".concat(e.asUnknown(),", ").concat(n.asUnknown(),")"),3)}case"op.letterOf":return new b("((".concat(this.descendInput(t.string).asString(),")[(").concat(this.descendInput(t.letter).asNumber(),' | 0) - 1] || "")'),2);case"op.ln":return new b("Math.log(".concat(this.descendInput(t.value).asNumber(),")"),5);case"op.log":return new b("(Math.log(".concat(this.descendInput(t.value).asNumber(),") / Math.LN10)"),5);case"op.mod":return this.descendedIntoModulo=!0,new b("mod(".concat(this.descendInput(t.left).asNumber(),", ").concat(this.descendInput(t.right).asNumber(),")"),5);case"op.multiply":return new b("(".concat(this.descendInput(t.left).asNumber()," * ").concat(this.descendInput(t.right).asNumber(),")"),5);case"op.not":return new b("!".concat(this.descendInput(t.operand).asBoolean()),3);case"op.or":return new b("(".concat(this.descendInput(t.left).asBoolean()," || ").concat(this.descendInput(t.right).asBoolean(),")"),3);case"op.random":return t.useInts?new b("randomInt(".concat(this.descendInput(t.low).asNumber(),", ").concat(this.descendInput(t.high).asNumber(),")"),1):t.useFloats?new b("randomFloat(".concat(this.descendInput(t.low).asNumber(),", ").concat(this.descendInput(t.high).asNumber(),")"),5):new b("runtime.ext_scratch3_operators._random(".concat(this.descendInput(t.low).asUnknown(),", ").concat(this.descendInput(t.high).asUnknown(),")"),5);case"op.round":return new b("Math.round(".concat(this.descendInput(t.value).asNumber(),")"),1);case"op.sin":return new b("(Math.round(Math.sin((Math.PI * ".concat(this.descendInput(t.value).asNumber(),") / 180) * 1e10) / 1e10)"),5);case"op.sqrt":return new b("Math.sqrt(".concat(this.descendInput(t.value).asNumber(),")"),5);case"op.subtract":return new b("(".concat(this.descendInput(t.left).asNumber()," - ").concat(this.descendInput(t.right).asNumber(),")"),5);case"op.tan":return new b("tan(".concat(this.descendInput(t.value).asNumber(),")"),5);case"op.10^":return new b("(10 ** ".concat(this.descendInput(t.value).asNumber(),")"),1);case"procedures.call":{const e=t.code,n=t.variant,r=this.ir.procedures[n];if(null===r.stack)return new b('""',2);const i='thread.procedures["'.concat(h(n),'"]'),s=[];for(const e of t.arguments)s.push(this.descendInput(e).asSafe());const o=s.join(","),a=!this.isWarp&&e===this.script.procedureCode,c=this.isInHat;if(a||c){const t=r.yields?"yieldThenCallGenerator":"yieldThenCall";return new b("(yield* ".concat(t,"(").concat(i,", ").concat(o,"))"),4)}return r.yields?new b("(yield* ".concat(i,"(").concat(o,"))"),4):new b("".concat(i,"(").concat(o,")"),4)}case"procedures.argument":return new b("p".concat(t.index),4);case"sensing.answer":return new b("runtime.ext_scratch3_sensing._answer",2);case"sensing.colorTouchingColor":return new b("target.colorIsTouchingColor(colorToList(".concat(this.descendInput(t.target).asColor(),"), colorToList(").concat(this.descendInput(t.mask).asColor(),"))"),3);case"sensing.date":return new b("(new Date().getDate())",1);case"sensing.dayofweek":return new b("(new Date().getDay() + 1)",1);case"sensing.daysSince2000":return new b("daysSince2000()",1);case"sensing.distance":return new b("distance(".concat(this.descendInput(t.target).asString(),")"),1);case"sensing.hour":return new b("(new Date().getHours())",1);case"sensing.minute":return new b("(new Date().getMinutes())",1);case"sensing.month":return new b("(new Date().getMonth() + 1)",1);case"sensing.of":{const e=this.descendInput(t.object).asString(),n=t.property;if("constant"===t.object.kind){const r="_stage_"===t.object.value,i=r?"stage":this.evaluateOnce("runtime.getSpriteTargetByName(".concat(e,")"));if("volume"===n)return new b("(".concat(i," ? ").concat(i,".volume : 0)"),1);if(r)switch(n){case"background #":case"backdrop #":return new b("(".concat(i,".currentCostume + 1)"),1);case"backdrop name":return new b("".concat(i,".getCostumes()[").concat(i,".currentCostume].name"),2)}else switch(n){case"x position":return new b("(".concat(i," ? ").concat(i,".x : 0)"),1);case"y position":return new b("(".concat(i," ? ").concat(i,".y : 0)"),1);case"direction":return new b("(".concat(i," ? ").concat(i,".direction : 0)"),1);case"costume #":return new b("(".concat(i," ? ").concat(i,".currentCostume + 1 : 0)"),1);case"costume name":return new b("(".concat(i," ? ").concat(i,".getCostumes()[").concat(i,".currentCostume].name : 0)"),4);case"size":return new b("(".concat(i," ? ").concat(i,".size : 0)"),1)}const s=this.evaluateOnce("".concat(i," && ").concat(i,'.lookupVariableByNameAndType("').concat(h(n),'", "", true)'));return new b("(".concat(s," ? ").concat(s,".value : 0)"),4)}return new b("runtime.ext_scratch3_sensing.getAttributeOf({OBJECT: ".concat(e,', PROPERTY: "').concat(h(n),'" })'),4)}case"sensing.second":return new b("(new Date().getSeconds())",1);case"sensing.touching":return new b("target.isTouchingObject(".concat(this.descendInput(t.object).asUnknown(),")"),3);case"sensing.touchingColor":return new b("target.isTouchingColor(colorToList(".concat(this.descendInput(t.color).asColor(),"))"),3);case"sensing.username":return new b("runtime.ioDevices.userData.getUsername()",2);case"sensing.year":return new b("(new Date().getFullYear())",1);case"timer.get":return new b("runtime.ioDevices.clock.projectTimer()",1);case"tw.lastKeyPressed":return new b("runtime.ioDevices.keyboard.getLastKeyPressed()",2);case"var.get":return this.descendVariable(t.variable);default:throw r.warn("JS: Unknown input: ".concat(t.kind),t),new Error("JS: Unknown input: ".concat(t.kind))}}descendStackedBlock(t){switch(t.kind){case"addons.call":this.source+="".concat(this.descendAddonCall(t),";\n");break;case"compat":{const e=this.isLastBlockInLoop(),n=t.blockType;if(n===s.COMMAND||n===s.HAT)this.source+="".concat(this.generateCompatibilityLayerCall(t,e),";\n");else{if(n!==s.CONDITIONAL&&n!==s.LOOP)throw new Error("Unknown block type: ".concat(n));{const e=this.localVariables.next();this.source+="const ".concat(e," = createBranchInfo(").concat(n===s.LOOP,");\n"),this.source+="while (".concat(e,".branch = +(").concat(this.generateCompatibilityLayerCall(t,!1,e),")) {\n"),this.source+="switch (".concat(e,".branch) {\n");for(const e in t.substacks)this.source+="case ".concat(+e,": {\n"),this.descendStack(t.substacks[e],new T(!1)),this.source+="break;\n",this.source+="}\n";this.source+="}\n",this.source+="if (!".concat(e,".isLoop) break;\n"),this.yieldLoop(),this.source+="}\n"}}e&&(this.source+="if (hasResumedFromPromise) {hasResumedFromPromise = false;continue;}\n");break}case"control.createClone":this.source+="runtime.ext_scratch3_control._createClone(".concat(this.descendInput(t.target).asString(),", target);\n");break;case"control.deleteClone":this.source+="if (!target.isOriginal) {\n",this.source+="  runtime.disposeTarget(target);\n",this.source+="  runtime.stopForTarget(target);\n",this.retire(),this.source+="}\n";break;case"control.for":{this.resetVariableInputs();const e=this.localVariables.next();this.source+="var ".concat(e," = 0; "),this.source+="while (".concat(e," < ").concat(this.descendInput(t.count).asNumber(),") { "),this.source+="".concat(e,"++; "),this.source+="".concat(this.referenceVariable(t.variable),".value = ").concat(e,";\n"),this.descendStack(t.do,new T(!0)),this.yieldLoop(),this.source+="}\n";break}case"control.if":this.source+="if (".concat(this.descendInput(t.condition).asBoolean(),") {\n"),this.descendStack(t.whenTrue,new T(!1)),t.whenFalse.length&&(this.source+="} else {\n",this.descendStack(t.whenFalse,new T(!1))),this.source+="}\n";break;case"control.repeat":{const e=this.localVariables.next();this.source+="for (var ".concat(e," = ").concat(this.descendInput(t.times).asNumber(),"; ").concat(e," >= 0.5; ").concat(e,"--) {\n"),this.descendStack(t.do,new T(!0)),this.yieldLoop(),this.source+="}\n";break}case"control.stopAll":this.source+="runtime.stopAll();\n",this.retire();break;case"control.stopOthers":this.source+="runtime.stopForTarget(target, thread);\n";break;case"control.stopScript":this.stopScript();break;case"control.wait":{const e=this.localVariables.next();this.source+="thread.timer = timer();\n",this.source+="var ".concat(e," = Math.max(0, 1000 * ").concat(this.descendInput(t.seconds).asNumber(),");\n"),this.requestRedraw(),this.yieldNotWarp(),this.source+="while (thread.timer.timeElapsed() < ".concat(e,") {\n"),this.yieldStuckOrNotWarp(),this.source+="}\n",this.source+="thread.timer = null;\n";break}case"control.waitUntil":this.resetVariableInputs(),this.source+="while (!".concat(this.descendInput(t.condition).asBoolean(),") {\n"),this.yieldStuckOrNotWarp(),this.source+="}\n";break;case"control.while":this.resetVariableInputs(),this.source+="while (".concat(this.descendInput(t.condition).asBoolean(),") {\n"),this.descendStack(t.do,new T(!0)),t.warpTimer?this.yieldStuckOrNotWarp():this.yieldLoop(),this.source+="}\n";break;case"counter.clear":this.source+="runtime.ext_scratch3_control._counter = 0;\n";break;case"counter.increment":this.source+="runtime.ext_scratch3_control._counter++;\n";break;case"hat.edge":this.isInHat=!0,this.source+="{\n",this.source+="const resolvedValue = ".concat(this.descendInput(t.condition).asBoolean(),";\n"),this.source+='const id = "'.concat(h(t.id),'";\n'),this.source+="const hasOldEdgeValue = target.hasEdgeActivatedValue(id);\n",this.source+="const oldEdgeValue = target.updateEdgeActivatedValue(id, resolvedValue);\n",this.source+="const edgeWasActivated = hasOldEdgeValue ? (!oldEdgeValue && resolvedValue) : resolvedValue;\n",this.source+="if (!edgeWasActivated) {\n",this.retire(),this.source+="}\n",this.source+="yield;\n",this.source+="}\n",this.isInHat=!1;break;case"hat.predicate":this.isInHat=!0,this.source+="if (!".concat(this.descendInput(t.condition).asBoolean(),") {\n"),this.retire(),this.source+="}\n",this.source+="yield;\n",this.isInHat=!1;break;case"event.broadcast":this.source+='startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: '.concat(this.descendInput(t.broadcast).asString()," });\n"),this.resetVariableInputs();break;case"event.broadcastAndWait":this.source+='yield* waitThreads(startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: '.concat(this.descendInput(t.broadcast).asString()," }));\n"),this.yielded();break;case"list.add":{const e=this.referenceVariable(t.list);this.source+="".concat(e,".value.push(").concat(this.descendInput(t.item).asSafe(),");\n"),this.source+="".concat(e,"._monitorUpToDate = false;\n");break}case"list.delete":{const e=this.referenceVariable(t.list),n=this.descendInput(t.index);if(n instanceof y){if("last"===n.constantValue){this.source+="".concat(e,".value.pop();\n"),this.source+="".concat(e,"._monitorUpToDate = false;\n");break}if(1==+n.constantValue){this.source+="".concat(e,".value.shift();\n"),this.source+="".concat(e,"._monitorUpToDate = false;\n");break}}this.source+="listDelete(".concat(e,", ").concat(n.asUnknown(),");\n");break}case"list.deleteAll":this.source+="".concat(this.referenceVariable(t.list),".value = [];\n");break;case"list.hide":this.source+='runtime.monitorBlocks.changeBlock({ id: "'.concat(h(t.list.id),'", element: "checkbox", value: false }, runtime);\n');break;case"list.insert":{const e=this.referenceVariable(t.list),n=this.descendInput(t.index),r=this.descendInput(t.item);if(n instanceof y&&1==+n.constantValue){this.source+="".concat(e,".value.unshift(").concat(r.asSafe(),");\n"),this.source+="".concat(e,"._monitorUpToDate = false;\n");break}this.source+="listInsert(".concat(e,", ").concat(n.asUnknown(),", ").concat(r.asSafe(),");\n");break}case"list.replace":this.source+="listReplace(".concat(this.referenceVariable(t.list),", ").concat(this.descendInput(t.index).asUnknown(),", ").concat(this.descendInput(t.item).asSafe(),");\n");break;case"list.show":this.source+='runtime.monitorBlocks.changeBlock({ id: "'.concat(h(t.list.id),'", element: "checkbox", value: true }, runtime);\n');break;case"looks.backwardLayers":this.target.isStage||(this.source+="target.goBackwardLayers(".concat(this.descendInput(t.layers).asNumber(),");\n"));break;case"looks.clearEffects":this.source+="target.clearEffects();\n";break;case"looks.changeEffect":Object.prototype.hasOwnProperty.call(this.target.effects,t.effect)&&(this.source+='target.setEffect("'.concat(h(t.effect),'", runtime.ext_scratch3_looks.clampEffect("').concat(h(t.effect),'", ').concat(this.descendInput(t.value).asNumber(),' + target.effects["').concat(h(t.effect),'"]));\n'));break;case"looks.changeSize":this.source+="target.setSize(target.size + ".concat(this.descendInput(t.size).asNumber(),");\n");break;case"looks.forwardLayers":this.target.isStage||(this.source+="target.goForwardLayers(".concat(this.descendInput(t.layers).asNumber(),");\n"));break;case"looks.goToBack":this.target.isStage||(this.source+="target.goToBack();\n");break;case"looks.goToFront":this.target.isStage||(this.source+="target.goToFront();\n");break;case"looks.hide":this.source+="target.setVisible(false);\n",this.source+="runtime.ext_scratch3_looks._renderBubble(target);\n";break;case"looks.nextBackdrop":this.source+="runtime.ext_scratch3_looks._setBackdrop(stage, stage.currentCostume + 1, true);\n";break;case"looks.nextCostume":this.source+="target.setCostume(target.currentCostume + 1);\n";break;case"looks.setEffect":Object.prototype.hasOwnProperty.call(this.target.effects,t.effect)&&(this.source+='target.setEffect("'.concat(h(t.effect),'", runtime.ext_scratch3_looks.clampEffect("').concat(h(t.effect),'", ').concat(this.descendInput(t.value).asNumber(),"));\n"));break;case"looks.setSize":this.source+="target.setSize(".concat(this.descendInput(t.size).asNumber(),");\n");break;case"looks.show":this.source+="target.setVisible(true);\n",this.source+="runtime.ext_scratch3_looks._renderBubble(target);\n";break;case"looks.switchBackdrop":this.source+="runtime.ext_scratch3_looks._setBackdrop(stage, ".concat(this.descendInput(t.backdrop).asSafe(),");\n");break;case"looks.switchCostume":this.source+="runtime.ext_scratch3_looks._setCostume(target, ".concat(this.descendInput(t.costume).asSafe(),");\n");break;case"motion.changeX":this.source+="target.setXY(target.x + ".concat(this.descendInput(t.dx).asNumber(),", target.y);\n");break;case"motion.changeY":this.source+="target.setXY(target.x, target.y + ".concat(this.descendInput(t.dy).asNumber(),");\n");break;case"motion.ifOnEdgeBounce":this.source+="runtime.ext_scratch3_motion._ifOnEdgeBounce(target);\n";break;case"motion.setDirection":this.source+="target.setDirection(".concat(this.descendInput(t.direction).asNumber(),");\n");break;case"motion.setRotationStyle":this.source+='target.setRotationStyle("'.concat(h(t.style),'");\n');break;case"motion.setX":case"motion.setY":case"motion.setXY":{this.descendedIntoModulo=!1;const e="x"in t?this.descendInput(t.x).asNumber():"target.x",n="y"in t?this.descendInput(t.y).asNumber():"target.y";this.source+="target.setXY(".concat(e,", ").concat(n,");\n"),this.descendedIntoModulo&&(this.source+="if (target.interpolationData) target.interpolationData = null;\n");break}case"motion.step":this.source+="runtime.ext_scratch3_motion._moveSteps(".concat(this.descendInput(t.steps).asNumber(),", target);\n");break;case"noop":break;case"pen.clear":this.source+="".concat(d,".clear();\n");break;case"pen.down":this.source+="".concat(d,"._penDown(target);\n");break;case"pen.changeParam":this.source+="".concat(d,"._setOrChangeColorParam(").concat(this.descendInput(t.param).asString(),", ").concat(this.descendInput(t.value).asNumber(),", ").concat(p,", true);\n");break;case"pen.changeSize":this.source+="".concat(d,"._changePenSizeBy(").concat(this.descendInput(t.size).asNumber(),", target);\n");break;case"pen.legacyChangeHue":this.source+="".concat(d,"._changePenHueBy(").concat(this.descendInput(t.hue).asNumber(),", target);\n");break;case"pen.legacyChangeShade":this.source+="".concat(d,"._changePenShadeBy(").concat(this.descendInput(t.shade).asNumber(),", target);\n");break;case"pen.legacySetHue":this.source+="".concat(d,"._setPenHueToNumber(").concat(this.descendInput(t.hue).asNumber(),", target);\n");break;case"pen.legacySetShade":this.source+="".concat(d,"._setPenShadeToNumber(").concat(this.descendInput(t.shade).asNumber(),", target);\n");break;case"pen.setColor":this.source+="".concat(d,"._setPenColorToColor(").concat(this.descendInput(t.color).asColor(),", target);\n");break;case"pen.setParam":this.source+="".concat(d,"._setOrChangeColorParam(").concat(this.descendInput(t.param).asString(),", ").concat(this.descendInput(t.value).asNumber(),", ").concat(p,", false);\n");break;case"pen.setSize":this.source+="".concat(d,"._setPenSizeTo(").concat(this.descendInput(t.size).asNumber(),", target);\n");break;case"pen.stamp":this.source+="".concat(d,"._stamp(target);\n");break;case"pen.up":this.source+="".concat(d,"._penUp(target);\n");break;case"procedures.call":{const e=t.code,n=t.variant,r=this.ir.procedures[n];if(null===r.stack)break;!this.isWarp&&e===this.script.procedureCode&&this.yieldNotWarp(),r.yields&&(this.source+="yield* "),this.source+='thread.procedures["'.concat(h(n),'"](');const i=[];for(const e of t.arguments)i.push(this.descendInput(e).asSafe());this.source+=i.join(","),this.source+=");\n",this.resetVariableInputs();break}case"procedures.return":this.stopScriptAndReturn(this.descendInput(t.value).asSafe());break;case"timer.reset":this.source+="runtime.ioDevices.clock.resetProjectTimer();\n";break;case"tw.debugger":this.source+="debugger;\n";break;case"var.hide":this.source+='runtime.monitorBlocks.changeBlock({ id: "'.concat(h(t.variable.id),'", element: "checkbox", value: false }, runtime);\n');break;case"var.set":{const e=this.descendVariable(t.variable),n=this.descendInput(t.value);e.setInput(n),this.source+="".concat(e.source," = ").concat(n.asSafe(),";\n"),t.variable.isCloud&&(this.source+='runtime.ioDevices.cloud.requestUpdateVariable("'.concat(h(t.variable.name),'", ').concat(e.source,");\n"));break}case"var.show":this.source+='runtime.monitorBlocks.changeBlock({ id: "'.concat(h(t.variable.id),'", element: "checkbox", value: true }, runtime);\n');break;case"visualReport":{const e=this.localVariables.next();this.source+="const ".concat(e," = ").concat(this.descendInput(t.input).asUnknown(),";"),this.source+="if (".concat(e,' !== undefined) runtime.visualReport(target, "').concat(h(this.script.topBlockId),'", ').concat(e,");\n");break}default:throw r.warn("JS: Unknown stacked block: ".concat(t.kind),t),new Error("JS: Unknown stacked block: ".concat(t.kind))}}descendInputRecord(t){let e="{";for(const n of Object.keys(t)){const r=t[n];e+='"'.concat(h(n),'":').concat(this.descendInput(r).asSafe(),",")}return e+="}",e}resetVariableInputs(){this.variableInputs={}}descendStack(t,e){this.resetVariableInputs(),this.pushFrame(e);for(let n=0;n<t.length;n++)e.isLastBlock=n===t.length-1,this.descendStackedBlock(t[n]);this.resetVariableInputs(),this.popFrame()}descendVariable(t){if(Object.prototype.hasOwnProperty.call(this.variableInputs,t.id))return this.variableInputs[t.id];const e=new v("".concat(this.referenceVariable(t),".value"));return this.variableInputs[t.id]=e,e}referenceVariable(t){return"target"===t.scope?this.evaluateOnce('target.variables["'.concat(h(t.id),'"]')):this.evaluateOnce('stage.variables["'.concat(h(t.id),'"]'))}descendAddonCall(t){const e=this.descendInputRecord(t.arguments),n='runtime.getAddonBlock("'.concat(h(t.code),'").callback'),r='"'.concat(h(t.blockId),'"');return"yield* executeInCompatibilityLayer(".concat(e,", ").concat(n,", ").concat(this.isWarp,", false, ").concat(r,")")}evaluateOnce(t){if(Object.prototype.hasOwnProperty.call(this._setupVariables,t))return this._setupVariables[t];const e=this._setupVariablesPool.next();return this._setupVariables[t]=e,e}retire(){this.isProcedure?this.source+="retire(); yield;\n":this.source+="retire(); return;\n"}stopScript(){this.isProcedure?this.source+='return "";\n':this.retire()}stopScriptAndReturn(t){this.isProcedure?this.source+="return ".concat(t,";\n"):this.retire()}yieldLoop(){this.warpTimer?this.yieldStuckOrNotWarp():this.yieldNotWarp()}yieldNotWarp(){this.isWarp||(this.source+="yield;\n",this.yielded())}yieldStuckOrNotWarp(){this.isWarp?this.source+="if (isStuck()) yield;\n":this.source+="yield;\n",this.yielded()}yielded(){if(!this.script.yields)throw new Error("Script yielded but is not marked as yielding.");this.resetVariableInputs()}requestRedraw(){this.source+="runtime.requestRedraw();\n"}safeConstantInput(t){const e="string"==typeof t&&this.namesOfCostumesAndSounds.has(t);return new y(t,!e)}generateCompatibilityLayerCall(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const r=t.opcode;let i="yield* executeInCompatibilityLayer({";for(const e of Object.keys(t.inputs)){const n=t.inputs[e],r=this.descendInput(n).asSafe();i+='"'.concat(h(e),'":').concat(r,",")}for(const e of Object.keys(t.fields)){const n=t.fields[e];i+='"'.concat(h(e),'":"').concat(h(n),'",')}const s=this.evaluateOnce('runtime.getOpcodeFunction("'.concat(h(r),'")'));return i+="}, ".concat(s,", ").concat(this.isWarp,", ").concat(e,', "').concat(h(t.id),'", ').concat(n,")"),this.yielded(),i}getScriptFactoryName(){return f.next()}getScriptName(t){let e=t?g.next():m.next();if(this.isProcedure){const t=this.script.procedureCode.replace(/%[\w]/g,"").replace(/[^a-zA-Z0-9]/g,"_").substring(0,20);e+="_".concat(t)}return e}createScriptFactory(){let t="";t+="(function ".concat(this.getScriptFactoryName(),"(thread) { "),t+="const target = thread.target; ",t+="const runtime = target.runtime; ",t+="const stage = runtime.getTargetForStage();\n";for(const e of Object.keys(this._setupVariables)){const n=this._setupVariables[e];t+="const ".concat(n," = ").concat(e,";\n")}if(t+="return ",this.script.yields?t+="function* ":t+="function ",t+=this.getScriptName(this.script.yields),t+=" (",this.script.arguments.length){const e=[];for(let t=0;t<this.script.arguments.length;t++)e.push("p".concat(t));t+=e.join(",")}return t+=") {\n",t+=this.source,t+="}; })",t}compile(){this.script.stack&&this.descendStack(this.script.stack,new T(!1)),this.stopScript();const t=this.createScriptFactory(),e=a.scopedEval(t);return this.debug&&r.info("JS: ".concat(this.target.getName(),": compiled ").concat(this.script.procedureCode||"script"),t),E.testingApparatus&&E.testingApparatus.report(this,t),e}}E.unstable_exports={TYPE_NUMBER:1,TYPE_STRING:2,TYPE_BOOLEAN:3,TYPE_UNKNOWN:4,TYPE_NUMBER_NAN:5,factoryNameVariablePool:f,functionNameVariablePool:m,generatorNameVariablePool:g,VariablePool:o,PEN_EXT:d,PEN_STATE:p,TypedInput:b,ConstantInput:y,VariableInput:v,Frame:T,sanitize:h},E.testingApparatus=null,t.exports=E},function(t,e,n){const r=n(22),i=n(13);t.exports=class{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.sequencer=t,this.thread=e,this._nowObj={now:()=>this.sequencer.runtime.currentMSecs}}get target(){return this.thread.target}get runtime(){return this.sequencer.runtime}get nowObj(){return this.runtime?this._nowObj:null}get stackFrame(){const t=this.thread.peekStackFrame();return null===t.executionContext&&(t.executionContext={}),t.executionContext}stackTimerFinished(){return!(this.stackFrame.timer.timeElapsed()<this.stackFrame.duration)}stackTimerNeedsInit(){return!this.stackFrame.timer}startStackTimer(t){this.nowObj?this.stackFrame.timer=new i(this.nowObj):this.stackFrame.timer=new i,this.stackFrame.timer.start(),this.stackFrame.duration=t}yield(){this.thread.status=r.STATUS_YIELD}yieldTick(){this.thread.status=r.STATUS_YIELD_TICK}startBranch(t,e){this.sequencer.stepToBranch(this.thread,t,e)}stopAll(){this.sequencer.runtime.stopAll()}stopOtherTargetThreads(){this.sequencer.runtime.stopForTarget(this.thread.target,this.thread)}stopThisScript(){this.thread.stopThisScript()}startProcedure(t){this.sequencer.stepToProcedure(this.thread,t)}getProcedureParamNamesAndIds(t){return this.thread.target.blocks.getProcedureParamNamesAndIds(t)}getProcedureParamNamesIdsAndDefaults(t){return this.thread.target.blocks.getProcedureParamNamesIdsAndDefaults(t)}initParams(){this.thread.initParams()}pushParam(t,e){this.thread.pushParam(t,e)}getParam(t){return this.thread.getParam(t)}startHats(t,e,n){const r=this.thread,i=this.sequencer,s=this.sequencer.runtime.startHats(t,e,n);return this.thread=r,this.sequencer=i,s}ioQuery(t,e,n){if(this.sequencer.runtime.ioDevices[t]&&this.sequencer.runtime.ioDevices[t][e]){const r=this.sequencer.runtime.ioDevices[t];return r[e].apply(r,n)}}}},function(t,e){t.exports={OUTPUT_SHAPE_HEXAGONAL:1,OUTPUT_SHAPE_ROUND:2,OUTPUT_SHAPE_SQUARE:3}},function(t,e,n){const r=n(12);class i{constructor(t){this.runtime=t,this.provider=null,this._skinId=-1,this._drawable=-1,this._ghost=0,this._forceTransparentPreview=!1}static get FORMAT_IMAGE_DATA(){return"image-data"}static get FORMAT_CANVAS(){return"canvas"}static get DIMENSIONS(){return[480,360]}static get ORDER(){return 1}setProvider(t){this.provider=t}enableVideo(){return this.provider?this.provider.enableVideo().then((()=>this._setupPreview())):null}disableVideo(){if(this._disablePreview(),!this.provider)return null;this.provider.disableVideo()}getFrame(t){let{dimensions:e=i.DIMENSIONS,mirror:n=this.mirror,format:r=i.FORMAT_IMAGE_DATA,cacheTimeout:s=this._frameCacheTimeout}=t;return this.provider?this.provider.getFrame({dimensions:e,mirror:n,format:r,cacheTimeout:s}):null}setPreviewGhost(t){this._ghost=t,-1!==this._drawable&&this.runtime.renderer.updateDrawableEffect(this._drawable,"ghost",this._forceTransparentPreview?100:t)}_disablePreview(){-1!==this._skinId&&(this.runtime.renderer.updateBitmapSkin(this._skinId,new ImageData(...i.DIMENSIONS),1),this.runtime.renderer.updateDrawableVisible(this._drawable,!1)),this._renderPreviewFrame=null}_setupPreview(){const{renderer:t}=this.runtime;t&&(-1===this._skinId&&-1===this._drawable&&(this._skinId=t.createBitmapSkin(new ImageData(...i.DIMENSIONS),1),this._drawable=t.createDrawable(r.VIDEO_LAYER),t.updateDrawableSkinId(this._drawable,this._skinId),t.markSkinAsPrivate&&t.markSkinAsPrivate(this._skinId),t.markDrawableAsNoninteractive&&t.markDrawableAsNoninteractive(this._drawable)),this._renderPreviewFrame||(t.updateDrawableEffect(this._drawable,"ghost",this._forceTransparentPreview?100:this._ghost),t.updateDrawableVisible(this._drawable,!0),this._renderPreviewFrame=()=>{if(clearTimeout(this._renderPreviewTimeout),!this._renderPreviewFrame)return;this._renderPreviewTimeout=setTimeout(this._renderPreviewFrame,this.runtime.currentStepTime);const e=this.getFrame({format:i.FORMAT_IMAGE_DATA,cacheTimeout:this.runtime.currentStepTime});e?(t.updateBitmapSkin(this._skinId,e,1),this.runtime.requestRedraw()):t.updateBitmapSkin(this._skinId,new ImageData(...i.DIMENSIONS),1)},this._renderPreviewFrame()))}get videoReady(){return!!this.provider&&this.provider.videoReady}postData(t){let{forceTransparentPreview:e}=t;this._forceTransparentPreview=e,this.setPreviewGhost(this._ghost)}}t.exports=i},function(t,e){t.exports={generateExtensionId:t=>{const e=t.replace(/[^a-z0-9]/gi,"").toLowerCase();return"sbx".concat(e)},argumentIndexToId:t=>t.toString()}},function(t,e){t.exports=class{constructor(t,e){this.callback=t,this.maxConcurrent=e,this._current=0,this._queue=[]}do(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new Promise(((t,n)=>{this._queue.push([t,n,e]),this._startNext()}))}_startNext(){if(this._current>=this.maxConcurrent||0===this._queue.length)return;this._current++;const[t,e,n]=this._queue.shift();this.callback.apply(null,n).then((e=>{t(e),this._current--,this._startNext()})).catch((t=>{e(t),this._current--,this._startNext()}))}}},function(t,e){class n{static _mergeVarRefObjects(t,e){for(const n in e)t[n]?t[n]=t[n].concat(e[n]):t[n]=e[n];return t}static getAllVarRefsForTargets(t,e){return t.map((t=>t.blocks.getAllVariableAndListReferences(null,e))).reduce(n._mergeVarRefObjects,{})}static updateVariableIdentifiers(t,e,n){t.map((t=>(t.referencingField.id=e,n&&(t.referencingField.value=n),t)))}}t.exports=n},function(t,e,n){const r=n(48),i=n(49),s=n(74),o=n(75),a=n(232),c=n(235),u=(t,e)=>{const n=[],r=t=>{t.localName!==e&&void 0!==e||!t.getAttribute||n.push(t);for(let e=0;e<t.childNodes.length;e++)r(t.childNodes[e])};return r(t),n},l=t=>{const e=c(),n=document.createElement("span"),i=t.outerHTML,s=r.sanitize(i,{USE_PROFILES:{svg:!0},FORBID_TAGS:["a","audio","canvas","video"],ADD_DATA_URI_TAGS:["image"]});let o,a;try{n.innerHTML=s,e.appendChild(n),o=n.children[0].getBBox()}finally{e.removeChild(n)}a=0===o.width||0===o.height?0:(t=>{let e=0;const n=t=>{t.getAttribute&&(t.getAttribute("stroke")&&(e=Math.max(e,1)),t.getAttribute("stroke-width")&&(e=Math.max(e,Number(t.getAttribute("stroke-width"))||0)));for(let e=0;e<t.childNodes.length;e++)n(t.childNodes[e])};return n(t),e})(t)/2;const u=o.width+2*a,l=o.height+2*a,h=o.x-a,d=o.y-a;t.setAttribute("width",u),t.setAttribute("height",l),t.setAttribute("viewBox",`${h} ${d} ${u} ${l}`)},h=(t,e)=>{e&&(t=>{const e=u(t,"linearGradient");for(const t of e)t.getAttribute("x2")||t.setAttribute("x2","0")})(t),a(t,window),(t=>{const e=u(t,"image"),n="image-rendering: optimizespeed; image-rendering: pixelated;";for(const t of e)t.getAttribute("style")?t.setAttribute("style",`${n} ${t.getAttribute("style")}`):t.setAttribute("style",n)})(t),e?((t=>{const e=[],n=t=>{"text"===t.localName&&e.push(t);for(let e=0;e<t.childNodes.length;e++)n(t.childNodes[e])};n(t),s(t);for(const n of e){n.removeAttribute("x"),n.removeAttribute("y"),n.setAttribute("alignment-baseline","text-before-edge"),n.setAttribute("xml:space","preserve"),n.getAttribute("font-size")||n.setAttribute("font-size","18");let e=n.textContent;const r=parseFloat(n.getAttribute("font-size")),s=2;let o=0,a=1.2;if("Handwriting"===n.getAttribute("font-family")?(a=2,o=-11*r/22):"Scratch"===n.getAttribute("font-family")?(a=.89,o=-3*r/22):"Curly"===n.getAttribute("font-family")?(a=1.38,o=-6*r/22):"Marker"===n.getAttribute("font-family")?(a=1.45,o=-6*r/22):"Sans Serif"===n.getAttribute("font-family")?(a=1.13,o=-3*r/22):"Serif"===n.getAttribute("font-family")&&(a=1.25,o=-4*r/22),0===n.transform.baseVal.numberOfItems){const e=t.createSVGTransform();n.transform.baseVal.appendItem(e)}const c=n.transform.baseVal.getItem(0).matrix;if(c.e+=c.a*s+c.c*o,c.f+=c.b*s+c.d*o,e&&0===n.childElementCount){n.textContent="";const t=e.split("\n");e="";for(const e of t){const t=i.create("tspan");t.setAttribute("x","0"),t.setAttribute("style","white-space: pre"),t.setAttribute("dy",`${a}em`),t.textContent=e||" ",n.appendChild(t)}}}})(t),l(t),(t=>{const e=u(t);for(const t of e){if(!t.style)continue;const e=t.style.stroke||t.getAttribute("stroke");e&&e.match(/^url\(#.*\)$/)&&(t.style["stroke-linejoin"]="round",t.style["stroke-linecap"]="round")}})(t)):t.getAttribute("viewBox")?t.getAttribute("width")&&t.getAttribute("height")||(t.setAttribute("width",t.viewBox.baseVal.width),t.setAttribute("height",t.viewBox.baseVal.height)):l(t)};t.exports=(t,e)=>{const n=new DOMParser;t=o(t);const r=n.parseFromString(t,"text/xml");if(r.childNodes.length<1||"svg"!==r.documentElement.localName)throw new Error("Document does not appear to be SVG.");const i=r.documentElement;return h(i,e),i}},function(t,e){t.exports=function(t){const e=[],n=t=>{"text"===t.localName&&e.push(t);for(let e=0;e<t.childNodes.length;e++)n(t.childNodes[e])};n(t);for(const t of e)t.getAttribute("font-family")&&"Helvetica"!==t.getAttribute("font-family")?"Mystery"===t.getAttribute("font-family")?t.setAttribute("font-family","Curly"):"Gloria"===t.getAttribute("font-family")?t.setAttribute("font-family","Handwriting"):"Donegal"===t.getAttribute("font-family")&&t.setAttribute("font-family","Serif"):t.setAttribute("font-family","Sans Serif")}},function(t,e){t.exports=function(t){const e=t.match(/<svg [^>]*>/);e&&-1===e[0].indexOf("xmlns=")&&(t=t.replace("<svg ",'<svg xmlns="http://www.w3.org/2000/svg" ')),e&&-1!==e[0].indexOf("&ns_")&&-1===t.indexOf("<!DOCTYPE")&&(t=t.replace(e[0],e[0].replace(/&ns_[^;]+;/g,"http://ns.adobe.com/Extensibility/1.0/"))),t.includes("data:img/png")&&(t=t.replace(/(<image[^>]+?xlink:href=["'])data:img\/png/g,((t,e)=>`${e}data:image/png`)));const n=/(<[^>]+?xmlns:(?!xml=)[^ ]+=)"http:\/\/www.w3.org\/XML\/1998\/namespace"/g;return null!==t.match(n)&&(t=t.replace(n,((t,e)=>`${e}"http://dummy.namespace"`))),t=(t=(t=t.replace(/<(\/?)\s*svg:/g,"<$1")).replace(/<metadata>[\s\S]*<\/metadata>/,"<metadata></metadata>")).replace(/<script[\s\S]*>[\s\S]*<\/script>/,"<script><\/script>")}},function(t,e,n){const r=n(77);t.exports=(t,e)=>{let n=(new XMLSerializer).serializeToString(t);return e&&(n=r(n,e)),n}},function(t,e,n){const r=n(236);t.exports=function(t,e={}){if("string"!=typeof t)throw new Error("SVG to be inlined is not a string");const n={};if(e&&"object"==typeof e)for(const[t,r]of Object.entries(e))n[(i=t,i.replace(/[<>&'"]/g,(t=>{switch(t){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";case"'":return"&apos;";case'"':return"&quot;"}})))]=r;var i;try{Object.assign(n,r())}catch(t){}const s=new Set,o=/font-family="([^"]*)"/g;let a=o.exec(t);for(;a;)s.add(a[1]),a=o.exec(t);if(s.size>0){let e="<defs><style>";for(const t of s)Object.prototype.hasOwnProperty.call(n,t)&&(e+=`${n[t]}`);return e+="</style></defs>",t=t.replace(/<svg[^>]*>/,`$&${e}`)}return t}},function(t,e,n){let r,i;"undefined"==typeof TextEncoder?(r=n(18).TextEncoder,i=n(18).TextDecoder):(r=TextEncoder,i=TextDecoder);const s="<!".concat("-".repeat(2)),o="".concat("-".repeat(2),">"),a=new RegExp("".concat(s,"rotationCenter:(-?[\\d\\.]+):(-?[\\d\\.]+)").concat(o,"$"));t.exports={parseVectorMetadata:t=>{const e=t.match(a);if(!e)return null;const n=+e[1],r=+e[2];return Number.isNaN(n)||Number.isNaN(r)?null:[n,r]},exportCostume:t=>{const e=t.asset.data;if("svg"!==t.dataFormat)return e;let n=(new i).decode(e);n=n.replace(a,"");const c=t.rotationCenterX,u=t.rotationCenterY;return n+="".concat(s,"rotationCenter:").concat(c,":").concat(u).concat(o),(new r).encode(n)}}},function(t,e,n){const r=n(7);t.exports=t=>{const e={};for(let n=0;n<t.length;n++){const i=r(),s=t[n].id;t[n].id=e[s]=i}for(let n=0;n<t.length;n++){for(const r in t[n].inputs){const i=t[n].inputs[r];i.block=e[i.block],i.shadow=e[i.shadow]}t[n].parent&&(t[n].parent=e[t[n].parent]),t[n].next&&(t[n].next=e[t[n].next])}}},function(t,e,n){const r=t=>function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return new Promise(((e,r)=>{t(...n,((t,n)=>{t?r("string"==typeof t?new Error(t):t):e(n)}))}))};var i=r(n(250)),s=r(n(252)),o=r(n(253));t.exports=function(t,e,n){i(t,e).then((function(t){return s(t[0]).then(o.bind(null,e)).then((function(e){return[e,t[1]]}))})).then(n.bind(null,null),n)}},function(t,e,n){const r=n(19),i=n(0);t.exports={deserializeSound:function(t,e,n,s){const o=s||t.md5,a=e.storage;if(!a)return i.warn("No storage module present; cannot load sound asset: ",o),Promise.resolve(null);if(!n)return Promise.resolve(null);let c=n.file(o);if(!c){const t=new RegExp("^([^/]*/)?".concat(o,"$"));c=n.file(t)[0]}if(!c)return i.error("Could not find sound file associated with the ".concat(t.name," sound.")),Promise.resolve(null);if(!r.support.uint8array)return i.error("JSZip uint8array is not supported in this browser."),Promise.resolve(null);const u="mp3"===t.dataFormat.toLowerCase()?a.DataFormat.MP3:a.DataFormat.WAV;return c.async("uint8array").then((t=>a.createAsset(a.AssetType.Sound,u,t,null,!0))).then((e=>{t.asset=e,t.assetId=e.assetId,t.md5="".concat(e.assetId,".").concat(e.dataFormat)}))},deserializeCostume:function(t,e,n,s,o){const a=e.storage,c=t.assetId,u=s||"".concat(c,".").concat(t.dataFormat);if(!a)return i.warn("No storage module present; cannot load costume asset: ",u),Promise.resolve(null);if(t.asset)return Promise.resolve(a.createAsset(t.asset.assetType,t.asset.dataFormat,new Uint8Array(Object.keys(t.asset.data).map((e=>t.asset.data[e]))),null,!0)).then((e=>{t.asset=e,t.assetId=e.assetId,t.md5="".concat(e.assetId,".").concat(e.dataFormat)}));if(!n)return Promise.resolve(null);let l=n.file(u);if(!l){const t=new RegExp("^([^/]*/)?".concat(u,"$"));l=n.file(t)[0]}if(!l)return i.error("Could not find costume file associated with the ".concat(t.name," costume.")),Promise.resolve(null);let h=null;const d=t.dataFormat.toLowerCase();if("svg"===d?h=a.AssetType.ImageVector:["png","bmp","jpeg","jpg","gif"].indexOf(d)>=0?h=a.AssetType.ImageBitmap:i.error("Unexpected file format for costume: ".concat(d)),!r.support.uint8array)return i.error("JSZip uint8array is not supported in this browser."),Promise.resolve(null);let p;if(t.textLayerMD5){const e=n.file(o);if(!e)return i.error("Could not find text layer file associated with the ".concat(t.name," costume.")),Promise.resolve(null);p=e.async("uint8array").then((e=>a.createAsset(a.AssetType.ImageBitmap,"png",e,t.textLayerMD5))).then((e=>{t.textLayerAsset=e}))}else p=Promise.resolve(null);return Promise.all([p,l.async("uint8array").then((t=>a.createAsset(h,d,t,null,!0))).then((e=>{t.asset=e,t.assetId=e.assetId,t.md5="".concat(e.assetId,".").concat(e.dataFormat)}))])}}},function(t,e,n){const r=n(15),i=n(45),s=n(47),o=n(20),a=n(0),c=n(7),u=n(6),l=n(4),h=n(256),d=n(46),p=n(9),f=n(40),m=n(12),g=n(70),{loadCostume:b}=n(31),{loadSound:y}=n(30),{deserializeCostume:v,deserializeSound:w}=n(81),T=["argument","control","data","event","looks","math","motion","operator","procedures","sensing","sound"],E=/\u001f|\./,A=t=>{const[e,n]=t.split(E),r=g.generateExtensionId(e);return"".concat(r,"_").concat(n)},k=function(t){const e=[{}];let n=0;const r=t.split(/(?=[^\\]%[nbs])/);for(let t=0;t<r.length;t++){const i=r[t].trim();if("%"===i.substring(0,1)){const t=i.substring(1,2),r={type:"input",inputName:"input"+n++};"n"===t?r.inputOp="math_number":"s"===t?r.inputOp="text":"b"===t&&(r.inputOp="boolean"),e.push(r)}}return e},I=function(t){return k(t).map((t=>t.inputName)).filter((t=>t))},S=function(t){let e=[];for(let n=0;n<t.length;n++){const r=t[n];e.push(r),r.children&&(e=e.concat(S(r.children))),delete r.children}return e},x=function(t,e,n,r,i,s,o){const a=[];let c=null;for(let u=0;u<t.length;u++){const l=t[u],h=L(l,e,n,r,i,s,o),d=h[0];o=h[1],d&&(c&&(d.parent=c.id,c.next=d.id),c=d,a.push(d))}return[a,o]},O=function(){let t={};const e=(t,e,n)=>"".concat(t,"-").concat(u.replaceUnsafeChars(e),"-").concat(n);return function(n,r){return r&&(t={}),function(i,s){return r?(t["".concat(i,"-").concat(s)]=e(n,i,s),t["".concat(i,"-").concat(s)]):t["".concat(i,"-").concat(s)]?t["".concat(i,"-").concat(s)]:e(n,i,s)}}}(),M=function(){let t={};const e=[],n=c();return function(r){return r&&(t={}),{broadcastMsgMapUpdater:function(r,i){return""===(r=r.toLowerCase())&&(r=n),t[r]="broadcastMsgId-".concat(u.replaceUnsafeChars(r)),e.push(i),t[r]},globalBroadcastMsgs:t,allBroadcastFields:e,emptyMsgName:n}}}(),N=(t,e,n,r)=>{if(!h[t.cmd])return void a.warn("Could not find monitor block with opcode: ".concat(t.cmd));const i=h[t.cmd].opcode,s=i.indexOf("_"),o=i.substring(0,s);if("videoSensing"===o)return;if(-1===T.indexOf(o)&&""!==o&&!r.extensionIDs.has(o)&&!t.visible)return;let c=null;if(!Object.prototype.hasOwnProperty.call(t,"target"))for(let e=0;e<n.length;e++){const r=n[e];Object.keys(r.variables).filter((e=>{const n=r.variables[e];return n.type===p.LIST_TYPE&&n.name===t.listName})).length>0&&(c=r,t.target=r.getName())}if(c=c||n.filter((e=>e.getName()===t.target))[0],!c)throw new Error("Cannot create monitor for target that cannot be found by name");const u=O(c.id,!1),[l,d]=L([t.cmd,t.param],null,u,r,{},null,null);"getVar:"===t.cmd?l.id=u(t.param,p.SCALAR_TYPE):"contentsOfList:"===t.cmd?l.id=u(t.param,p.LIST_TYPE):Object.prototype.hasOwnProperty.call(e.monitorBlockInfo,l.opcode)?l.id=e.monitorBlockInfo[l.opcode].getId(c.id,l.fields):l.id=l.opcode,l.targetId=c.isStage?null:c.id,l.isMonitored=t.visible;const m=e.monitorBlocks._blocks[l.id];if(m)m.isMonitored=t.visible,m.targetId=l.targetId;else{const t=S([l]);for(let n=0;n<t.length;n++)e.monitorBlocks.createBlock(t[n])}switch(t.mode){case 1:t.mode="default";break;case 2:t.mode="large";break;case 3:t.mode="slider"}e.requestAddMonitor(f({id:l.id,targetId:l.targetId,spriteName:l.targetId?t.target:null,opcode:l.opcode,params:e.monitorBlocks._getBlockParams(l),value:"",mode:t.mode,sliderMin:t.sliderMin,sliderMax:t.sliderMax,isDiscrete:t.isDiscrete,x:t.x,y:t.y,width:t.width,height:t.height,visible:t.visible}))},C=function(t,e,n,r){if(!Object.prototype.hasOwnProperty.call(t,"objName"))return null;const i={costumePromises:[],soundPromises:[],soundBank:e.audioEngine&&e.audioEngine.createBank(),children:[]},s=i.costumePromises;if(Object.prototype.hasOwnProperty.call(t,"costumes"))for(let i=0;i<t.costumes.length;i++){const o=t.costumes[i],a=o.bitmapResolution||1,c={name:o.costumeName,bitmapResolution:a,rotationCenterX:n?240*a:o.rotationCenterX,rotationCenterY:n?180*a:o.rotationCenterY,md5:o.baseLayerMD5,skinId:null},l=o.baseLayerMD5,h=u.splitFirst(l,"."),d=h[0];let p;2===h.length&&h[1]?p=h[1]:(p="png",c.md5="".concat(c.md5,".").concat(p)),c.dataFormat=p,c.assetId=d,o.textLayerMD5&&(c.textLayerMD5=u.splitFirst(o.textLayerMD5,".")[0]);const f="".concat(o.baseLayerID,".").concat(p),m=o.textLayerID?"".concat(o.textLayerID,".png"):null;s.push(e.wrapAssetRequest((()=>v(c,e,r,f,m).then((()=>b(c.md5,c,e,2))))))}const{soundBank:o,soundPromises:a}=i;if(Object.prototype.hasOwnProperty.call(t,"sounds"))for(let n=0;n<t.sounds.length;n++){const i=t.sounds[n],s={name:i.soundName,format:i.format,rate:i.rate,sampleCount:i.sampleCount,md5:i.md5,data:null},c=i.md5,l=u.splitFirst(c,"."),h=l[0],d=l[1].toLowerCase();s.dataFormat=d,s.assetId=h;const p="".concat(i.soundID,".").concat(d);a.push(e.wrapAssetRequest((()=>w(s,e,r,p).then((()=>y(s,e,o))))))}const c=i.children;if(t.children)for(let n=0;n<t.children.length;n++)c.push(C(t.children[n],e,!1,r));return i},R=function(t,e,n,o,a,c){if(!Object.prototype.hasOwnProperty.call(t,"objName"))return Object.prototype.hasOwnProperty.call(t,"listName")&&(t.cmd="contentsOfList:",t.param=t.listName,t.mode="list"),t.deferredMonitor=!0,Promise.resolve(t);const u=new r(e),h=new s(u,e);if(Object.prototype.hasOwnProperty.call(t,"objName")){if(o&&"Stage"!==t.objName){for(const e of t.children)Object.prototype.hasOwnProperty.call(e,"objName")||e.target!==t.objName||(e.target="Stage");t.objName="Stage"}h.name=t.objName}const f=c.costumePromises,{soundBank:b,soundPromises:y}=c,v=h.createClone(o?m.BACKGROUND_LAYER:m.SPRITE_LAYER),w=O(v.id,o),T=M(o),E=T.broadcastMsgMapUpdater;if(Object.prototype.hasOwnProperty.call(t,"variables"))for(let n=0;n<t.variables.length;n++){const r=t.variables[n],i=r.isPersistent&&o&&e.canAddCloudVariable(),s=new p(w(r.name,p.SCALAR_TYPE),r.name,p.SCALAR_TYPE,i);i&&e.addCloudVariable(),s.value=r.value,v.variables[s.id]=s}const A={};if(Object.prototype.hasOwnProperty.call(t,"scriptComments")){t.scriptComments.map((t=>{const[e,n,r,i,s,o,a]=t,c=t[5]>=0,u=new d(null,a,c?null:1.5*e,c?null:2.2*n,1.5*r,2.2*i,!s);return c&&(u.blockId=o,Object.prototype.hasOwnProperty.call(A,o)?A[o].push(u):A[o]=[u]),u})).forEach((t=>{v.comments[t.id]=t}))}Object.prototype.hasOwnProperty.call(t,"scripts")&&function(t,e,n,r,i,s){let o=0;for(let a=0;a<t.length;a++){const c=t[a],u=c[0],l=c[1],h=c[2],d={},[p,f]=x(h,n,r,i,d,s,o);o=f,p[0]&&(p[0].x=1.5*u,p[0].y=2.2*l,p[0].topLevel=!0,p[0].parent=null);const m=S(p);for(let t=0;t<m.length;t++)e.createBlock(m[t])}}(t.scripts,u,E,w,n,A);for(const t in A){A[t].forEach((t=>{"number"==typeof t.blockId&&(t.blockId=null)}))}if(u.updateTargetSpecificBlocks(o),Object.prototype.hasOwnProperty.call(t,"lists"))for(let e=0;e<t.lists.length;e++){const n=t.lists[e],r=new p(w(n.listName,p.LIST_TYPE),n.listName,p.LIST_TYPE,!1);r.value=n.contents,v.variables[r.id]=r}Object.prototype.hasOwnProperty.call(t,"scratchX")&&(v.x=t.scratchX),Object.prototype.hasOwnProperty.call(t,"scratchY")&&(v.y=t.scratchY),Object.prototype.hasOwnProperty.call(t,"direction")&&(v.direction=l.wrapClamp(t.direction,-179,180)),Object.prototype.hasOwnProperty.call(t,"isDraggable")&&(v.draggable=t.isDraggable),Object.prototype.hasOwnProperty.call(t,"scale")&&(v.size=100*t.scale),Object.prototype.hasOwnProperty.call(t,"visible")&&(v.visible=t.visible),Object.prototype.hasOwnProperty.call(t,"currentCostumeIndex")&&(v.currentCostume=l.clamp(Math.floor(t.currentCostumeIndex),0,t.costumes.length-1)),Object.prototype.hasOwnProperty.call(t,"rotationStyle")&&("none"===t.rotationStyle?v.rotationStyle=i.ROTATION_STYLE_NONE:"leftRight"===t.rotationStyle?v.rotationStyle=i.ROTATION_STYLE_LEFT_RIGHT:"normal"===t.rotationStyle&&(v.rotationStyle=i.ROTATION_STYLE_ALL_AROUND)),Object.prototype.hasOwnProperty.call(t,"tempoBPM")&&(v.tempo=t.tempoBPM),Object.prototype.hasOwnProperty.call(t,"videoAlpha")&&(v.videoTransparency=100-100*t.videoAlpha),Object.prototype.hasOwnProperty.call(t,"info")&&Object.prototype.hasOwnProperty.call(t.info,"videoOn")&&(t.info.videoOn?v.videoState=i.VIDEO_STATE.ON:v.videoState=i.VIDEO_STATE.OFF),Object.prototype.hasOwnProperty.call(t,"indexInLibrary")&&(v.targetPaneOrder=t.indexInLibrary),v.isStage=o,Promise.all(f).then((t=>{h.costumes=t})),Promise.all(y).then((t=>{h.sounds=t,h.soundBank=b||null}));const k=[];if(t.children)for(let r=0;r<t.children.length;r++)k.push(R(t.children[r],e,n,!1,a,c.children[r]));if(o){const e=t.info&&t.info.savedExtensions;if(Array.isArray(e))for(const t of e){const e=g.generateExtensionId(t.extensionName),r=t.javascriptURL;n.extensionURLs.set(e,r)}}return Promise.all(f.concat(y)).then((()=>Promise.all(k).then((t=>{if(v.isStage){const t=T.globalBroadcastMsgs,e=T.allBroadcastFields,n=T.emptyMsgName;if(t[n]){let r=1;for(;t["message".concat(r)];)r+=1;const i="message".concat(r);t[i]=t[n],delete t[n];for(let t=0;t<e.length;t++)""===e[t].value&&(e[t].value=i)}for(const e in t){const n=t[e],r=new p(n,e,p.BROADCAST_MESSAGE_TYPE,!1);v.variables[r.id]=r}}let r=[v];const i=[];for(let e=0;e<t.length;e++)t[e]&&(t[e].deferredMonitor?i.push(t[e]):r=r.concat(t[e]));for(let t=0;t<i.length;t++)N(i[t],e,r,n);return r}))))},D=function(t){const e=t.map(((t,e)=>(t.layerOrder=e,t))).sort(((t,e)=>t.targetPaneOrder-e.targetPaneOrder));return e.forEach((t=>{delete t.targetPaneOrder})),e},P=function(t){const e=t[0],n=e&&h[e];return n?"function"==typeof n?n(t):n:e&&(t=>E.test(t))(e)?(t=>{const e=t[0],n=t.length-1,r=[];for(let t=0;t<n;t++)r.push({type:"input",inputOp:"text",inputName:g.argumentIndexToId(t)});return{opcode:A(e),argMap:r}})(t):(a.warn("Couldn't find SB2 block: ".concat(e)),null)},L=function(t,e,n,r,i,s,u){const l=s&&"number"==typeof u&&!isNaN(u)?s[u]:null,h=P(t);if(!h)return l&&l.forEach((t=>{t.blockId=null,t.x=t.y=0})),[null,u+1];const d=t[0],f=h.opcode.indexOf("_"),m=h.opcode.substring(0,f);-1===T.indexOf(m)&&""!==m&&r.extensionIDs.add(m);const g={id:c(),opcode:h.opcode,inputs:{},fields:{},next:null,shadow:!1,children:[]};l&&(g.comment=l[l.length-1].id,l.forEach((t=>{t.id===g.comment?t.blockId=g.id:(t.blockId=null,t.x=t.y=0)}))),u++;const b=i.expectedArg;"call"===d&&(h.argMap=k(t[1]));for(let l=0;l<h.argMap.length;l++){const d=h.argMap[l],f=t[l+1];let m=!1;if("input"===d.type){const t=c();if(g.inputs[d.inputName]={name:d.inputName,block:null,shadow:null},"object"==typeof f&&f){let t;if(i.expectedArg=d,"object"==typeof f[0]&&f[0])[t,u]=x(f,e,n,r,i,s,u);else{const o=L(f,e,n,r,i,s,u);t=o[0]?[o[0]]:[],u=o[1]}if(i.expectedArg=b,t.length>0){let e=null;for(let n=0;n<t.length;n++)t[n].parent=0===n?g.id:e,e=t[n].id;g.inputs[d.inputName].block=t[0].id,g.children=g.children.concat(t)}m=!0}if(!d.inputOp){a.warn("Unknown input operation for input ".concat(d.inputName," of opcode ").concat(g.opcode,"."));continue}if("boolean"===d.inputOp||"substack"===d.inputOp)continue;let l=f,h=d.inputName;"math_number"===d.inputOp||"math_whole_number"===d.inputOp||"math_positive_number"===d.inputOp||"math_integer"===d.inputOp||"math_angle"===d.inputOp?(h="NUM",m&&(l=10)):"text"===d.inputOp?(h="TEXT",m&&(l="")):"colour_picker"===d.inputOp?(l=o.decimalToHex(f),h="COLOUR",m&&(l="#990000")):"event_broadcast_menu"===d.inputOp?(h="BROADCAST_OPTION",m&&(l="")):"sensing_of_object_menu"===d.inputOp?(m||"Stage"===l)&&(l="_stage_"):"note"===d.inputOp?m&&(l=60):"music.menu.DRUM"===d.inputOp||"music.menu.INSTRUMENT"===d.inputOp?m&&(l=1):"videoSensing.menu.ATTRIBUTE"===d.inputOp?m&&(l="motion"):"videoSensing.menu.SUBJECT"===d.inputOp?m&&(l="this sprite"):"videoSensing.menu.VIDEO_STATE"===d.inputOp?m&&(l="on"):m&&(l="");const p={};if(p[h]={name:h,value:l},"event_broadcast_menu"===d.inputOp){const t=e(l,p[h]);p[h].id=t,p[h].variableType=d.variableType}g.children.push({id:t,opcode:d.inputOp,inputs:{},fields:p,next:null,topLevel:!1,parent:g.id,shadow:!0}),g.inputs[d.inputName].shadow=t,g.inputs[d.inputName].block||(g.inputs[d.inputName].block=t)}else if("field"===d.type){if(g.fields[d.fieldName]={name:d.fieldName,value:f},"CURRENTMENU"===d.fieldName&&(g.fields[d.fieldName].value=f.toUpperCase(),"day of week"===f&&(g.fields[d.fieldName].value="DAYOFWEEK")),"VARIABLE"===d.fieldName)g.fields[d.fieldName].id=n(f,p.SCALAR_TYPE);else if("LIST"===d.fieldName)g.fields[d.fieldName].id=n(f,p.LIST_TYPE);else if("BROADCAST_OPTION"===d.fieldName){const t=e(f,g.fields[d.fieldName]);g.fields[d.fieldName].id=t}const t=d.variableType;"string"==typeof t&&(g.fields[d.fieldName].variableType=t)}}switch(d){case"comeToFront":g.fields.FRONT_BACK={name:"FRONT_BACK",value:"front"};break;case"goBackByLayers:":g.fields.FORWARD_BACKWARD={name:"FORWARD_BACKWARD",value:"backward"};break;case"backgroundIndex":case"costumeIndex":g.fields.NUMBER_NAME={name:"NUMBER_NAME",value:"number"};break;case"sceneName":case"costumeName":g.fields.NUMBER_NAME={name:"NUMBER_NAME",value:"name"}}if("stopScripts"===d)"other scripts in sprite"!==t[1]&&"other scripts in stage"!==t[1]||(g.mutation={tagName:"mutation",hasnext:"true",children:[]});else if("procDef"===d){const e=t.slice(1),n=c(),r="custom_block";g.inputs[r]={name:r,block:n,shadow:n},g.children=[{id:n,opcode:"procedures_prototype",inputs:{},fields:{},next:null,shadow:!0,children:[],mutation:{tagName:"mutation",proccode:e[0],argumentnames:JSON.stringify(e[1]),argumentids:JSON.stringify(I(e[0])),argumentdefaults:JSON.stringify(e[2]),warp:e[3],children:[]}}]}else if("call"===d)g.mutation={tagName:"mutation",children:[],proccode:t[1],argumentids:JSON.stringify(I(t[1]))};else if("getParam"===d){let e=t[2];switch(b&&"boolean"===b.inputOp&&"b"!==e&&(e="b"),e){case"r":g.opcode="argument_reporter_string_number";break;case"b":g.opcode="argument_reporter_boolean"}}return[g,u]};t.exports={deserialize:function(t,e,n,r){const i={extensionIDs:new Set,extensionURLs:new Map};return Promise.resolve(C(t,e,!n,r)).then((t=>Promise.resolve(t))).then((s=>R(t,e,i,!n,r,s))).then(D).then((t=>({targets:t,extensions:i})))}}},function(t,e,n){const r=n(258);t.exports=r},function(t,e){class n{constructor(){this.left=-1/0,this.right=1/0,this.bottom=-1/0,this.top=1/0}initFromBounds(t,e,n,r){this.left=t,this.right=e,this.bottom=n,this.top=r}initFromPointsAABB(t){this.left=1/0,this.right=-1/0,this.top=-1/0,this.bottom=1/0;for(let e=0;e<t.length;e++){const n=t[e][0],r=t[e][1];n<this.left&&(this.left=n),n>this.right&&(this.right=n),r>this.top&&(this.top=r),r<this.bottom&&(this.bottom=r)}}initFromModelMatrix(t){const e=t[12],n=t[13],r=Math.abs(.5*t[0])+Math.abs(.5*t[4]),i=Math.abs(.5*t[1])+Math.abs(.5*t[5]);this.left=-r+e,this.right=r+e,this.top=i+n,this.bottom=-i+n}intersects(t){return this.left<=t.right&&t.left<=this.right&&this.top>=t.bottom&&t.top>=this.bottom}contains(t){return t.left>this.left&&t.right<this.right&&t.top<this.top&&t.bottom>this.bottom}clamp(t,e,n,r){this.left=Math.max(this.left,t),this.right=Math.min(this.right,e),this.bottom=Math.max(this.bottom,n),this.top=Math.min(this.top,r),this.left=Math.min(this.left,e),this.right=Math.max(this.right,t),this.bottom=Math.min(this.bottom,r),this.top=Math.max(this.top,n)}snapToInt(){this.left=Math.floor(this.left),this.right=Math.ceil(this.right),this.bottom=Math.floor(this.bottom),this.top=Math.ceil(this.top)}static intersect(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new n;return r.left=Math.max(t.left,e.left),r.right=Math.min(t.right,e.right),r.top=Math.min(t.top,e.top),r.bottom=Math.max(t.bottom,e.bottom),r}static union(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new n;return r.left=Math.min(t.left,e.left),r.right=Math.max(t.right,e.right),r.top=Math.max(t.top,e.top),r.bottom=Math.min(t.bottom,e.bottom),r}get width(){return Math.abs(this.left-this.right)}get height(){return Math.abs(this.top-this.bottom)}}t.exports=n},function(t,e,n){const r=n(10),{rgbToHsv:i,hsvToRgb:s}=n(269),o=n(26),a=.5,c=.5,u=[0,0,0];t.exports=class{static transformColor(t,e,n){if(0===e[3])return e;let r=t.enabledEffects;"number"==typeof n&&(r&=n);const a=t.getUniforms(),c=!!(r&o.EFFECT_INFO.color.mask),l=!!(r&o.EFFECT_INFO.brightness.mask);if(c||l){const t=e[3]/255;if(e[0]/=t,e[1]/=t,e[2]/=t,c){const t=i(e,u),n=.055,r=.09;t[2]<n?(t[0]=0,t[1]=1,t[2]=n):t[1]<r&&(t[0]=0,t[1]=r),t[0]=a.u_color+t[0]+1,s(t,e)}if(l){const t=255*a.u_brightness;e[0]+=t,e[1]+=t,e[2]+=t}e[0]*=t,e[1]*=t,e[2]*=t}return r&o.EFFECT_INFO.ghost.mask&&(e[0]*=a.u_ghost,e[1]*=a.u_ghost,e[2]*=a.u_ghost,e[3]*=a.u_ghost),e}static transformPoint(t,e,n){r.v3.copy(e,n);const i=t.enabledEffects,s=t.getUniforms();if(i&o.EFFECT_INFO.mosaic.mask&&(n[0]=s.u_mosaic*n[0]%1,n[1]=s.u_mosaic*n[1]%1),i&o.EFFECT_INFO.pixelate.mask){const e=t.skin.getUniforms(),r=e.u_skinSize[0]/s.u_pixelate,i=e.u_skinSize[1]/s.u_pixelate;n[0]=(Math.floor(n[0]*r)+a)/r,n[1]=(Math.floor(n[1]*i)+c)/i}if(i&o.EFFECT_INFO.whirl.mask){const t=.5,e=n[0]-a,r=n[1]-c,i=Math.sqrt(Math.pow(e,2)+Math.pow(r,2)),o=Math.max(1-i/t,0),u=s.u_whirl*o*o,l=Math.sin(u),h=Math.cos(u),d=h,p=-l,f=l,m=h;n[0]=d*e+f*r+a,n[1]=p*e+m*r+c}if(i&o.EFFECT_INFO.fisheye.mask){const t=(n[0]-a)/a,e=(n[1]-c)/c,r=Math.sqrt(t*t+e*e),i=Math.pow(Math.min(r,1),s.u_fisheye)*Math.max(1,r),o=t/r,u=e/r;n[0]=a+i*o*a,n[1]=c+i*u*c}return n}}},function(t,e,n){const r=n(27);r.enable(),t.exports=r("scratch-render")},function(t,e){t.exports=class{constructor(t){this._ctx=t,this._cache={}}beginMeasurementSession(){}endMeasurementSession(){}measureText(t){return this._cache[t]||(this._cache[t]=this._ctx.measureText(t).width),this._cache[t]}clearCache(){this._cache={}}}},function(t,e,n){var r,i;i=n(275),r=function(){function t(t){var e,n,r;(e="function"==typeof t.readUInt32BE&&"function"==typeof t.slice)||t instanceof Uint8Array?(e?(this.highStart=t.readUInt32BE(0),this.errorValue=t.readUInt32BE(4),n=t.readUInt32BE(8),t=t.slice(12)):(r=new DataView(t.buffer),this.highStart=r.getUint32(0),this.errorValue=r.getUint32(4),n=r.getUint32(8),t=t.subarray(12)),t=i(t,new Uint8Array(n)),t=i(t,new Uint8Array(n)),this.data=new Uint32Array(t.buffer)):(this.data=t.data,this.highStart=t.highStart,this.errorValue=t.errorValue)}return t.prototype.get=function(t){var e;return t<0||t>1114111?this.errorValue:t<55296||t>56319&&t<=65535?(e=(this.data[t>>5]<<2)+(31&t),this.data[e]):t<=65535?(e=(this.data[2048+(t-55296>>5)]<<2)+(31&t),this.data[e]):t<this.highStart?(e=this.data[2080+(t>>11)],e=((e=this.data[e+(t>>5&63)])<<2)+(31&t),this.data[e]):this.data[this.data.length-4]},t}(),t.exports=r},function(module,exports,__webpack_require__){var factory;window,factory=function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="./src/index.js")}({"./node_modules/@babel/runtime/helpers/objectWithoutProperties.js":function(t,e,n){var r=n("./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js");t.exports=function(t,e){if(null==t)return{};var n,i,s=r(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)n=o[i],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s},t.exports.__esModule=!0,t.exports.default=t.exports},"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js":function(t,e){t.exports=function(t,e){if(null==t)return{};var n,r,i={},s=Object.keys(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)>=0||(i[n]=t[n]);return i},t.exports.__esModule=!0,t.exports.default=t.exports},"./node_modules/arraybuffer-loader/lib/to-array-buffer.js":function(t,e,n){"use strict";(function(e){t.exports=function(t){for(var n="undefined"!=typeof window&&"function"==typeof window.atob?window.atob(t):e.from(t,"base64").toString("binary"),r=new Uint8Array(n.length),i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r.buffer}}).call(this,n("./node_modules/node-libs-browser/node_modules/buffer/index.js").Buffer)},"./node_modules/base64-js/index.js":function(t,e,n){"use strict";e.byteLength=function(t){var e=c(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){for(var e,n=c(t),r=n[0],o=n[1],a=new s(function(t,e,n){return 3*(e+n)/4-n}(0,r,o)),u=0,l=o>0?r-4:r,h=0;h<l;h+=4)e=i[t.charCodeAt(h)]<<18|i[t.charCodeAt(h+1)]<<12|i[t.charCodeAt(h+2)]<<6|i[t.charCodeAt(h+3)],a[u++]=e>>16&255,a[u++]=e>>8&255,a[u++]=255&e;return 2===o&&(e=i[t.charCodeAt(h)]<<2|i[t.charCodeAt(h+1)]>>4,a[u++]=255&e),1===o&&(e=i[t.charCodeAt(h)]<<10|i[t.charCodeAt(h+1)]<<4|i[t.charCodeAt(h+2)]>>2,a[u++]=e>>8&255,a[u++]=255&e),a},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,s=[],o=16383,a=0,c=n-i;a<c;a+=o)s.push(u(t,a,a+o>c?c:a+o));return 1===i?(e=t[n-1],s.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],s.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),s.join("")};for(var r=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=o[a],i[o.charCodeAt(a)]=a;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function u(t,e,n){for(var i,s,o=[],a=e;a<n;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),o.push(r[(s=i)>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},"./node_modules/cross-fetch/dist/browser-ponyfill.js":function(t,e){var n="undefined"!=typeof self?self:this,r=function(){function t(){this.fetch=!1,this.DOMException=n.DOMException}return t.prototype=n,new t}();!function(t){!function(e){var n="URLSearchParams"in t,r="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),s="FormData"in t,o="ArrayBuffer"in t;if(o)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function u(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function h(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return r&&(e[Symbol.iterator]=function(){return e}),e}function d(t){this.map={},t instanceof d?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function p(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function f(t){return new Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function m(t){var e=new FileReader,n=f(e);return e.readAsArrayBuffer(t),n}function g(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:s&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():o&&i&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=g(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o&&(ArrayBuffer.prototype.isPrototypeOf(t)||c(t))?this._bodyArrayBuffer=g(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=p(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(m)}),this.text=function(){var t,e,n,r=p(this);if(r)return r;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,n=f(e),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(t,e){t=u(t),e=l(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},d.prototype.delete=function(t){delete this.map[u(t)]},d.prototype.get=function(t){return t=u(t),this.has(t)?this.map[t]:null},d.prototype.has=function(t){return this.map.hasOwnProperty(u(t))},d.prototype.set=function(t,e){this.map[u(t)]=l(e)},d.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},d.prototype.keys=function(){var t=[];return this.forEach((function(e,n){t.push(n)})),h(t)},d.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),h(t)},d.prototype.entries=function(){var t=[];return this.forEach((function(e,n){t.push([n,e])})),h(t)},r&&(d.prototype[Symbol.iterator]=d.prototype.entries);var y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function v(t,e){var n,r,i=(e=e||{}).body;if(t instanceof v){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new d(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new d(e.headers)),this.method=(n=e.method||this.method||"GET",r=n.toUpperCase(),y.indexOf(r)>-1?r:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function w(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}})),e}function T(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new d(e.headers),this.url=e.url||"",this._initBody(t)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},b.call(v.prototype),b.call(T.prototype),T.prototype.clone=function(){return new T(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},T.error=function(){var t=new T(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];T.redirect=function(t,e){if(-1===E.indexOf(e))throw new RangeError("Invalid status code");return new T(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function A(t,n){return new Promise((function(r,s){var o=new v(t,n);if(o.signal&&o.signal.aborted)return s(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var t,e,n={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new d,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var n=t.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();e.append(r,i)}})),e)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;r(new T(i,n))},a.onerror=function(){s(new TypeError("Network request failed"))},a.ontimeout=function(){s(new TypeError("Network request failed"))},a.onabort=function(){s(new e.DOMException("Aborted","AbortError"))},a.open(o.method,o.url,!0),"include"===o.credentials?a.withCredentials=!0:"omit"===o.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),o.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),o.signal&&(o.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&o.signal.removeEventListener("abort",c)}),a.send(void 0===o._bodyInit?null:o._bodyInit)}))}A.polyfill=!0,t.fetch||(t.fetch=A,t.Headers=d,t.Request=v,t.Response=T),e.Headers=d,e.Request=v,e.Response=T,e.fetch=A,Object.defineProperty(e,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(e=i.fetch).default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e},"./node_modules/ieee754/index.js":function(t,e){e.read=function(t,e,n,r,i){var s,o,a=8*i-r-1,c=(1<<a)-1,u=c>>1,l=-7,h=n?i-1:0,d=n?-1:1,p=t[e+h];for(h+=d,s=p&(1<<-l)-1,p>>=-l,l+=a;l>0;s=256*s+t[e+h],h+=d,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=r;l>0;o=256*o+t[e+h],h+=d,l-=8);if(0===s)s=1-u;else{if(s===c)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,r),s-=u}return(p?-1:1)*o*Math.pow(2,s-r)},e.write=function(t,e,n,r,i,s){var o,a,c,u=8*s-i-1,l=(1<<u)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:s-1,f=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=l):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),(e+=o+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(o++,c/=2),o+h>=l?(a=0,o=l):o+h>=1?(a=(e*c-1)*Math.pow(2,i),o+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[n+p]=255&a,p+=f,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;t[n+p]=255&o,p+=f,o/=256,u-=8);t[n+p-f]|=128*m}},"./node_modules/js-md5/src/md5.js":function(module,exports,__webpack_require__){(function(process,global){var __WEBPACK_AMD_DEFINE_RESULT__;(function(){"use strict";var ERROR="input is invalid type",WINDOW="object"==typeof window,root=WINDOW?window:{};root.JS_MD5_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&"object"==typeof self,NODE_JS=!root.JS_MD5_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_MD5_NO_COMMON_JS&&"object"==typeof module&&module.exports,AMD=__webpack_require__("./node_modules/webpack/buildin/amd-options.js"),ARRAY_BUFFER=!root.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[128,32768,8388608,-2147483648],SHIFT=[0,8,16,24],OUTPUT_TYPES=["hex","array","digest","buffer","arrayBuffer","base64"],BASE64_ENCODE_CHAR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),blocks=[],buffer8;if(ARRAY_BUFFER){var buffer=new ArrayBuffer(68);buffer8=new Uint8Array(buffer),blocks=new Uint32Array(buffer)}!root.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!ARRAY_BUFFER||!root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var createOutputMethod=function(t){return function(e){return new Md5(!0).update(e)[t]()}},createMethod=function(){var t=createOutputMethod("hex");NODE_JS&&(t=nodeWrap(t)),t.create=function(){return new Md5},t.update=function(e){return t.create().update(e)};for(var e=0;e<OUTPUT_TYPES.length;++e){var n=OUTPUT_TYPES[e];t[n]=createOutputMethod(n)}return t},nodeWrap=function(method){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),nodeMethod=function(t){if("string"==typeof t)return crypto.createHash("md5").update(t,"utf8").digest("hex");if(null==t)throw ERROR;return t.constructor===ArrayBuffer&&(t=new Uint8Array(t)),Array.isArray(t)||ArrayBuffer.isView(t)||t.constructor===Buffer?crypto.createHash("md5").update(new Buffer(t)).digest("hex"):method(t)};return nodeMethod};function Md5(t){if(t)blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks,this.buffer8=buffer8;else if(ARRAY_BUFFER){var e=new ArrayBuffer(68);this.buffer8=new Uint8Array(e),this.blocks=new Uint32Array(e)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}Md5.prototype.update=function(t){if(!this.finalized){var e,n=typeof t;if("string"!==n){if("object"!==n)throw ERROR;if(null===t)throw ERROR;if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||ARRAY_BUFFER&&ArrayBuffer.isView(t)))throw ERROR;e=!0}for(var r,i,s=0,o=t.length,a=this.blocks,c=this.buffer8;s<o;){if(this.hashed&&(this.hashed=!1,a[0]=a[16],a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),e)if(ARRAY_BUFFER)for(i=this.start;s<o&&i<64;++s)c[i++]=t[s];else for(i=this.start;s<o&&i<64;++s)a[i>>2]|=t[s]<<SHIFT[3&i++];else if(ARRAY_BUFFER)for(i=this.start;s<o&&i<64;++s)(r=t.charCodeAt(s))<128?c[i++]=r:r<2048?(c[i++]=192|r>>6,c[i++]=128|63&r):r<55296||r>=57344?(c[i++]=224|r>>12,c[i++]=128|r>>6&63,c[i++]=128|63&r):(r=65536+((1023&r)<<10|1023&t.charCodeAt(++s)),c[i++]=240|r>>18,c[i++]=128|r>>12&63,c[i++]=128|r>>6&63,c[i++]=128|63&r);else for(i=this.start;s<o&&i<64;++s)(r=t.charCodeAt(s))<128?a[i>>2]|=r<<SHIFT[3&i++]:r<2048?(a[i>>2]|=(192|r>>6)<<SHIFT[3&i++],a[i>>2]|=(128|63&r)<<SHIFT[3&i++]):r<55296||r>=57344?(a[i>>2]|=(224|r>>12)<<SHIFT[3&i++],a[i>>2]|=(128|r>>6&63)<<SHIFT[3&i++],a[i>>2]|=(128|63&r)<<SHIFT[3&i++]):(r=65536+((1023&r)<<10|1023&t.charCodeAt(++s)),a[i>>2]|=(240|r>>18)<<SHIFT[3&i++],a[i>>2]|=(128|r>>12&63)<<SHIFT[3&i++],a[i>>2]|=(128|r>>6&63)<<SHIFT[3&i++],a[i>>2]|=(128|63&r)<<SHIFT[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},Md5.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[e>>2]|=EXTRA[3&e],e>=56&&(this.hashed||this.hash(),t[0]=t[16],t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.bytes<<3,t[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},Md5.prototype.hash=function(){var t,e,n,r,i,s,o=this.blocks;this.first?e=((e=((t=((t=o[0]-680876937)<<7|t>>>25)-271733879|0)^(n=((n=(-271733879^(r=((r=(-1732584194^2004318071&t)+o[1]-117830708)<<12|r>>>20)+t|0)&(-271733879^t))+o[2]-1126478375)<<17|n>>>15)+r|0)&(r^t))+o[3]-1316259209)<<22|e>>>10)+n|0:(t=this.h0,e=this.h1,n=this.h2,e=((e+=((t=((t+=((r=this.h3)^e&(n^r))+o[0]-680876936)<<7|t>>>25)+e|0)^(n=((n+=(e^(r=((r+=(n^t&(e^n))+o[1]-389564586)<<12|r>>>20)+t|0)&(t^e))+o[2]+606105819)<<17|n>>>15)+r|0)&(r^t))+o[3]-1044525330)<<22|e>>>10)+n|0),e=((e+=((t=((t+=(r^e&(n^r))+o[4]-176418897)<<7|t>>>25)+e|0)^(n=((n+=(e^(r=((r+=(n^t&(e^n))+o[5]+1200080426)<<12|r>>>20)+t|0)&(t^e))+o[6]-1473231341)<<17|n>>>15)+r|0)&(r^t))+o[7]-45705983)<<22|e>>>10)+n|0,e=((e+=((t=((t+=(r^e&(n^r))+o[8]+1770035416)<<7|t>>>25)+e|0)^(n=((n+=(e^(r=((r+=(n^t&(e^n))+o[9]-1958414417)<<12|r>>>20)+t|0)&(t^e))+o[10]-42063)<<17|n>>>15)+r|0)&(r^t))+o[11]-1990404162)<<22|e>>>10)+n|0,e=((e+=((t=((t+=(r^e&(n^r))+o[12]+1804603682)<<7|t>>>25)+e|0)^(n=((n+=(e^(r=((r+=(n^t&(e^n))+o[13]-40341101)<<12|r>>>20)+t|0)&(t^e))+o[14]-1502002290)<<17|n>>>15)+r|0)&(r^t))+o[15]+1236535329)<<22|e>>>10)+n|0,e=((e+=((r=((r+=(e^n&((t=((t+=(n^r&(e^n))+o[1]-165796510)<<5|t>>>27)+e|0)^e))+o[6]-1069501632)<<9|r>>>23)+t|0)^t&((n=((n+=(t^e&(r^t))+o[11]+643717713)<<14|n>>>18)+r|0)^r))+o[0]-373897302)<<20|e>>>12)+n|0,e=((e+=((r=((r+=(e^n&((t=((t+=(n^r&(e^n))+o[5]-701558691)<<5|t>>>27)+e|0)^e))+o[10]+38016083)<<9|r>>>23)+t|0)^t&((n=((n+=(t^e&(r^t))+o[15]-660478335)<<14|n>>>18)+r|0)^r))+o[4]-405537848)<<20|e>>>12)+n|0,e=((e+=((r=((r+=(e^n&((t=((t+=(n^r&(e^n))+o[9]+568446438)<<5|t>>>27)+e|0)^e))+o[14]-1019803690)<<9|r>>>23)+t|0)^t&((n=((n+=(t^e&(r^t))+o[3]-187363961)<<14|n>>>18)+r|0)^r))+o[8]+1163531501)<<20|e>>>12)+n|0,e=((e+=((r=((r+=(e^n&((t=((t+=(n^r&(e^n))+o[13]-1444681467)<<5|t>>>27)+e|0)^e))+o[2]-51403784)<<9|r>>>23)+t|0)^t&((n=((n+=(t^e&(r^t))+o[7]+1735328473)<<14|n>>>18)+r|0)^r))+o[12]-1926607734)<<20|e>>>12)+n|0,e=((e+=((s=(r=((r+=((i=e^n)^(t=((t+=(i^r)+o[5]-378558)<<4|t>>>28)+e|0))+o[8]-2022574463)<<11|r>>>21)+t|0)^t)^(n=((n+=(s^e)+o[11]+1839030562)<<16|n>>>16)+r|0))+o[14]-35309556)<<23|e>>>9)+n|0,e=((e+=((s=(r=((r+=((i=e^n)^(t=((t+=(i^r)+o[1]-1530992060)<<4|t>>>28)+e|0))+o[4]+1272893353)<<11|r>>>21)+t|0)^t)^(n=((n+=(s^e)+o[7]-155497632)<<16|n>>>16)+r|0))+o[10]-1094730640)<<23|e>>>9)+n|0,e=((e+=((s=(r=((r+=((i=e^n)^(t=((t+=(i^r)+o[13]+681279174)<<4|t>>>28)+e|0))+o[0]-358537222)<<11|r>>>21)+t|0)^t)^(n=((n+=(s^e)+o[3]-722521979)<<16|n>>>16)+r|0))+o[6]+76029189)<<23|e>>>9)+n|0,e=((e+=((s=(r=((r+=((i=e^n)^(t=((t+=(i^r)+o[9]-640364487)<<4|t>>>28)+e|0))+o[12]-421815835)<<11|r>>>21)+t|0)^t)^(n=((n+=(s^e)+o[15]+530742520)<<16|n>>>16)+r|0))+o[2]-995338651)<<23|e>>>9)+n|0,e=((e+=((r=((r+=(e^((t=((t+=(n^(e|~r))+o[0]-198630844)<<6|t>>>26)+e|0)|~n))+o[7]+1126891415)<<10|r>>>22)+t|0)^((n=((n+=(t^(r|~e))+o[14]-1416354905)<<15|n>>>17)+r|0)|~t))+o[5]-57434055)<<21|e>>>11)+n|0,e=((e+=((r=((r+=(e^((t=((t+=(n^(e|~r))+o[12]+1700485571)<<6|t>>>26)+e|0)|~n))+o[3]-1894986606)<<10|r>>>22)+t|0)^((n=((n+=(t^(r|~e))+o[10]-1051523)<<15|n>>>17)+r|0)|~t))+o[1]-2054922799)<<21|e>>>11)+n|0,e=((e+=((r=((r+=(e^((t=((t+=(n^(e|~r))+o[8]+1873313359)<<6|t>>>26)+e|0)|~n))+o[15]-30611744)<<10|r>>>22)+t|0)^((n=((n+=(t^(r|~e))+o[6]-1560198380)<<15|n>>>17)+r|0)|~t))+o[13]+1309151649)<<21|e>>>11)+n|0,e=((e+=((r=((r+=(e^((t=((t+=(n^(e|~r))+o[4]-145523070)<<6|t>>>26)+e|0)|~n))+o[11]-1120210379)<<10|r>>>22)+t|0)^((n=((n+=(t^(r|~e))+o[2]+718787259)<<15|n>>>17)+r|0)|~t))+o[9]-343485551)<<21|e>>>11)+n|0,this.first?(this.h0=t+1732584193|0,this.h1=e-271733879|0,this.h2=n-1732584194|0,this.h3=r+271733878|0,this.first=!1):(this.h0=this.h0+t|0,this.h1=this.h1+e|0,this.h2=this.h2+n|0,this.h3=this.h3+r|0)},Md5.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,r=this.h3;return HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]},Md5.prototype.toString=Md5.prototype.hex,Md5.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,r=this.h3;return[255&t,t>>8&255,t>>16&255,t>>24&255,255&e,e>>8&255,e>>16&255,e>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255]},Md5.prototype.array=Md5.prototype.digest,Md5.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(16),e=new Uint32Array(t);return e[0]=this.h0,e[1]=this.h1,e[2]=this.h2,e[3]=this.h3,t},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var t,e,n,r="",i=this.array(),s=0;s<15;)t=i[s++],e=i[s++],n=i[s++],r+=BASE64_ENCODE_CHAR[t>>>2]+BASE64_ENCODE_CHAR[63&(t<<4|e>>>4)]+BASE64_ENCODE_CHAR[63&(e<<2|n>>>6)]+BASE64_ENCODE_CHAR[63&n];return t=i[s],r+=BASE64_ENCODE_CHAR[t>>>2]+BASE64_ENCODE_CHAR[t<<4&63]+"=="};var exports=createMethod();COMMON_JS?module.exports=exports:(root.md5=exports,AMD&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return exports}.call(exports,__webpack_require__,exports,module),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))})()}).call(this,__webpack_require__("./node_modules/process/browser.js"),__webpack_require__("./node_modules/webpack/buildin/global.js"))},"./node_modules/node-libs-browser/node_modules/buffer/index.js":function(t,e,n){"use strict";(function(t){var r=n("./node_modules/base64-js/index.js"),i=n("./node_modules/ieee754/index.js"),s=n("./node_modules/node-libs-browser/node_modules/isarray/index.js");function o(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(o()<e)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=c.prototype:(null===t&&(t=new c(e)),t.length=e),t}function c(t,e,n){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return u(this,t,e,n)}function u(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r),c.TYPED_ARRAY_SUPPORT?(t=e).__proto__=c.prototype:t=d(t,e),t}(t,e,n,r):"string"==typeof e?function(t,e,n){if("string"==typeof n&&""!==n||(n="utf8"),!c.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|f(e,n),i=(t=a(t,r)).write(e,n);return i!==r&&(t=t.slice(0,i)),t}(t,e,n):function(t,e){if(c.isBuffer(e)){var n=0|p(e.length);return 0===(t=a(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?a(t,0):d(t,e);if("Buffer"===e.type&&s(e.data))return d(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function h(t,e){if(l(e),t=a(t,e<0?0:0|p(e)),!c.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function d(t,e){var n=e.length<0?0:0|p(e.length);t=a(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function p(t){if(t>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function f(t,e){if(c.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(t).length;default:if(r)return z(t).length;e=(""+e).toLowerCase(),r=!0}}function m(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return N(this,e,n);case"utf8":case"utf-8":return S(this,e,n);case"ascii":return O(this,e,n);case"latin1":case"binary":return M(this,e,n);case"base64":return I(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function g(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function b(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=c.from(e,r)),c.isBuffer(e))return 0===e.length?-1:y(t,e,n,r,i);if("number"==typeof e)return e&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):y(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,r,i){var s,o=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;o=2,a/=2,c/=2,n/=2}function u(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i){var l=-1;for(s=n;s<a;s++)if(u(t,s)===u(e,-1===l?0:s-l)){if(-1===l&&(l=s),s-l+1===c)return l*o}else-1!==l&&(s-=s-l),l=-1}else for(n+c>a&&(n=a-c),s=n;s>=0;s--){for(var h=!0,d=0;d<c;d++)if(u(t,s+d)!==u(e,d)){h=!1;break}if(h)return s}return-1}function v(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var s=e.length;if(s%2!=0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var o=0;o<r;++o){var a=parseInt(e.substr(2*o,2),16);if(isNaN(a))return o;t[n+o]=a}return o}function w(t,e,n,r){return G(z(e,t.length-n),t,n,r)}function T(t,e,n,r){return G(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function E(t,e,n,r){return T(t,e,n,r)}function A(t,e,n,r){return G(V(e),t,n,r)}function k(t,e,n,r){return G(function(t,e){for(var n,r,i,s=[],o=0;o<t.length&&!((e-=2)<0);++o)r=(n=t.charCodeAt(o))>>8,i=n%256,s.push(i),s.push(r);return s}(e,t.length-n),t,n,r)}function I(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function S(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var s,o,a,c,u=t[i],l=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h<=n)switch(h){case 1:u<128&&(l=u);break;case 2:128==(192&(s=t[i+1]))&&(c=(31&u)<<6|63&s)>127&&(l=c);break;case 3:s=t[i+1],o=t[i+2],128==(192&s)&&128==(192&o)&&(c=(15&u)<<12|(63&s)<<6|63&o)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:s=t[i+1],o=t[i+2],a=t[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(c=(15&u)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,h=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=h}return function(t){var e=t.length;if(e<=x)return String.fromCharCode.apply(String,t);for(var n="",r=0;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=x));return n}(r)}e.Buffer=c,e.SlowBuffer=function(t){return+t!=t&&(t=0),c.alloc(+t)},e.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=o(),c.poolSize=8192,c._augment=function(t){return t.__proto__=c.prototype,t},c.from=function(t,e,n){return u(null,t,e,n)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(t,e,n){return function(t,e,n,r){return l(e),e<=0?a(t,e):void 0!==n?"string"==typeof r?a(t,e).fill(n,r):a(t,e).fill(n):a(t,e)}(null,t,e,n)},c.allocUnsafe=function(t){return h(null,t)},c.allocUnsafeSlow=function(t){return h(null,t)},c.isBuffer=function(t){return!(null==t||!t._isBuffer)},c.compare=function(t,e){if(!c.isBuffer(t)||!c.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,s=Math.min(n,r);i<s;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},c.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(t,e){if(!s(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return c.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=c.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var o=t[n];if(!c.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},c.byteLength=f,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},c.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},c.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},c.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?S(this,0,t):m.apply(this,arguments)},c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===c.compare(this,t)},c.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},c.prototype.compare=function(t,e,n,r,i){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var s=(i>>>=0)-(r>>>=0),o=(n>>>=0)-(e>>>=0),a=Math.min(s,o),u=this.slice(r,i),l=t.slice(e,n),h=0;h<a;++h)if(u[h]!==l[h]){s=u[h],o=l[h];break}return s<o?-1:o<s?1:0},c.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},c.prototype.indexOf=function(t,e,n){return b(this,t,e,n,!0)},c.prototype.lastIndexOf=function(t,e,n){return b(this,t,e,n,!1)},c.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return v(this,t,e,n);case"utf8":case"utf-8":return w(this,t,e,n);case"ascii":return T(this,t,e,n);case"latin1":case"binary":return E(this,t,e,n);case"base64":return A(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var x=4096;function O(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function M(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function N(t,e,n){var r,i=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>i)&&(n=i);for(var s="",o=e;o<n;++o)s+=(r=t[o])<16?"0"+r.toString(16):r.toString(16);return s}function C(t,e,n){for(var r=t.slice(e,n),i="",s=0;s<r.length;s+=2)i+=String.fromCharCode(r[s]+256*r[s+1]);return i}function R(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,n,r,i,s){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function P(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,s=Math.min(t.length-n,2);i<s;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function L(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,s=Math.min(t.length-n,4);i<s;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function B(t,e,n,r,i,s){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function U(t,e,n,r,s){return s||B(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function j(t,e,n,r,s){return s||B(t,0,n,8),i.write(t,e,n,r,52,8),n+8}c.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),c.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=c.prototype;else{var i=e-t;n=new c(i,void 0);for(var s=0;s<i;++s)n[s]=this[s+t]}return n},c.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var r=this[t],i=1,s=0;++s<e&&(i*=256);)r+=this[t+s]*i;return r},c.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},c.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]},c.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var r=this[t],i=1,s=0;++s<e&&(i*=256);)r+=this[t+s]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},c.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var r=e,i=1,s=this[t+--r];r>0&&(i*=256);)s+=this[t+--r]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*e)),s},c.prototype.readInt8=function(t,e){return e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),i.read(this,t,!1,52,8)},c.prototype.writeUIntLE=function(t,e,n,r){t=+t,e|=0,n|=0,r||D(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,s=0;for(this[e]=255&t;++s<n&&(i*=256);)this[e+s]=t/i&255;return e+n},c.prototype.writeUIntBE=function(t,e,n,r){t=+t,e|=0,n|=0,r||D(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,s=1;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=t/s&255;return e+n},c.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,1,255,0),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},c.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},c.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},c.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):L(this,t,e,!0),e+4},c.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):L(this,t,e,!1),e+4},c.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);D(this,t,e,n,i-1,-i)}var s=0,o=1,a=0;for(this[e]=255&t;++s<n&&(o*=256);)t<0&&0===a&&0!==this[e+s-1]&&(a=1),this[e+s]=(t/o|0)-a&255;return e+n},c.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);D(this,t,e,n,i-1,-i)}var s=n-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o|0)-a&255;return e+n},c.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,1,127,-128),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},c.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},c.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):L(this,t,e,!0),e+4},c.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):L(this,t,e,!1),e+4},c.prototype.writeFloatLE=function(t,e,n){return U(this,t,e,!0,n)},c.prototype.writeFloatBE=function(t,e,n){return U(this,t,e,!1,n)},c.prototype.writeDoubleLE=function(t,e,n){return j(this,t,e,!0,n)},c.prototype.writeDoubleBE=function(t,e,n){return j(this,t,e,!1,n)},c.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,s=r-n;if(this===t&&n<e&&e<r)for(i=s-1;i>=0;--i)t[i+e]=this[i+n];else if(s<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i<s;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+s),e);return s},c.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var s;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=e;s<n;++s)this[s]=t;else{var o=c.isBuffer(t)?t:z(new c(t,r).toString()),a=o.length;for(s=0;s<n-e;++s)this[s+e]=o[s%a]}return this};var F=/[^+\/0-9A-Za-z-_]/g;function z(t,e){var n;e=e||1/0;for(var r=t.length,i=null,s=[],o=0;o<r;++o){if((n=t.charCodeAt(o))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===r){(e-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&s.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;s.push(n)}else if(n<2048){if((e-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function V(t){return r.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(F,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function G(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}}).call(this,n("./node_modules/webpack/buildin/global.js"))},"./node_modules/node-libs-browser/node_modules/isarray/index.js":function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},"./node_modules/process/browser.js":function(t,e){var n,r,i=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(t){n=s}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(t){r=o}}();var c,u=[],l=!1,h=-1;function d(){l&&c&&(l=!1,c.length?u=c.concat(u):h=-1,u.length&&p())}function p(){if(!l){var t=a(d);l=!0;for(var e=u.length;e;){for(c=u,u=[];++h<e;)c&&c[h].run();h=-1,e=u.length}c=null,l=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{return r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function f(t,e){this.fun=t,this.array=e}function m(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new f(t,e)),1!==u.length||l||a(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},"./node_modules/webpack/buildin/amd-options.js":function(t,e){(function(e){t.exports=e}).call(this,{})},"./node_modules/webpack/buildin/global.js":function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},'./node_modules/worker-loader/dist/cjs.js?{"inline":true,"fallback":true}!./src/FetchWorkerTool.worker.js':function(t,e,n){t.exports=function(){return n("./node_modules/worker-loader/dist/workers/InlineWorker.js")("/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = \"./node_modules/babel-loader/lib/index.js?!./src/FetchWorkerTool.worker.js\");\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ \"./node_modules/babel-loader/lib/index.js?!./src/FetchWorkerTool.worker.js\":\n/*!*******************************************************************************!*\\\n  !*** ./node_modules/babel-loader/lib??ref--4!./src/FetchWorkerTool.worker.js ***!\n  \\*******************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n/* eslint-env worker */\n\nconst isNullResponse = __webpack_require__(/*! ./isNullResponse */ \"./src/isNullResponse.js\");\nconst saferFetch = __webpack_require__(/*! ./safer-fetch */ \"./src/safer-fetch.js\");\nconst complete = [];\nlet timeoutId = null;\nconst checkCompleted = () => {\n  if (timeoutId) return;\n  timeoutId = setTimeout(() => {\n    timeoutId = null;\n    if (complete.length) {\n      // Send our chunk of completed requests and instruct postMessage to\n      // transfer the buffers instead of copying them.\n      postMessage(complete.slice(),\n      // Instruct postMessage that these buffers in the sent message\n      // should use their Transferable trait. After the postMessage\n      // call the \"buffers\" will still be in complete if you looked,\n      // but they will all be length 0 as the data they reference has\n      // been sent to the window. This lets us send a lot of data\n      // without the normal postMessage behaviour of making a copy of\n      // all of the data for the window.\n      complete.map(response => response.buffer).filter(Boolean));\n      complete.length = 0;\n    }\n  });\n};\n\n/**\n * Receive a job from the parent and fetch the requested data.\n * @param {object} options.job A job id, url, and options descriptor to perform.\n */\nconst onMessage = _ref => {\n  let {\n    data: job\n  } = _ref;\n  saferFetch(job.url, job.options).then(result => {\n    if (result.ok) return result.arrayBuffer();\n    if (isNullResponse(result)) return null;\n    return Promise.reject(result.status);\n  }).then(buffer => complete.push({\n    id: job.id,\n    buffer\n  })).catch(error => complete.push({\n    id: job.id,\n    error: error && error.message || \"Failed request: \".concat(job.url)\n  })).then(checkCompleted);\n};\n\n// crossFetch means \"fetch\" is now always supported\npostMessage({\n  support: {\n    fetch: true\n  }\n});\nself.addEventListener('message', onMessage);\n\n/***/ }),\n\n/***/ \"./node_modules/cross-fetch/dist/browser-ponyfill.js\":\n/*!***********************************************************!*\\\n  !*** ./node_modules/cross-fetch/dist/browser-ponyfill.js ***!\n  \\***********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nvar global = typeof self !== 'undefined' ? self : this;\nvar __self__ = (function () {\nfunction F() {\nthis.fetch = false;\nthis.DOMException = global.DOMException\n}\nF.prototype = global;\nreturn new F();\n})();\n(function(self) {\n\nvar irrelevant = (function (exports) {\n\n  var support = {\n    searchParams: 'URLSearchParams' in self,\n    iterable: 'Symbol' in self && 'iterator' in Symbol,\n    blob:\n      'FileReader' in self &&\n      'Blob' in self &&\n      (function() {\n        try {\n          new Blob();\n          return true\n        } catch (e) {\n          return false\n        }\n      })(),\n    formData: 'FormData' in self,\n    arrayBuffer: 'ArrayBuffer' in self\n  };\n\n  function isDataView(obj) {\n    return obj && DataView.prototype.isPrototypeOf(obj)\n  }\n\n  if (support.arrayBuffer) {\n    var viewClasses = [\n      '[object Int8Array]',\n      '[object Uint8Array]',\n      '[object Uint8ClampedArray]',\n      '[object Int16Array]',\n      '[object Uint16Array]',\n      '[object Int32Array]',\n      '[object Uint32Array]',\n      '[object Float32Array]',\n      '[object Float64Array]'\n    ];\n\n    var isArrayBufferView =\n      ArrayBuffer.isView ||\n      function(obj) {\n        return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n      };\n  }\n\n  function normalizeName(name) {\n    if (typeof name !== 'string') {\n      name = String(name);\n    }\n    if (/[^a-z0-9\\-#$%&'*+.^_`|~]/i.test(name)) {\n      throw new TypeError('Invalid character in header field name')\n    }\n    return name.toLowerCase()\n  }\n\n  function normalizeValue(value) {\n    if (typeof value !== 'string') {\n      value = String(value);\n    }\n    return value\n  }\n\n  // Build a destructive iterator for the value list\n  function iteratorFor(items) {\n    var iterator = {\n      next: function() {\n        var value = items.shift();\n        return {done: value === undefined, value: value}\n      }\n    };\n\n    if (support.iterable) {\n      iterator[Symbol.iterator] = function() {\n        return iterator\n      };\n    }\n\n    return iterator\n  }\n\n  function Headers(headers) {\n    this.map = {};\n\n    if (headers instanceof Headers) {\n      headers.forEach(function(value, name) {\n        this.append(name, value);\n      }, this);\n    } else if (Array.isArray(headers)) {\n      headers.forEach(function(header) {\n        this.append(header[0], header[1]);\n      }, this);\n    } else if (headers) {\n      Object.getOwnPropertyNames(headers).forEach(function(name) {\n        this.append(name, headers[name]);\n      }, this);\n    }\n  }\n\n  Headers.prototype.append = function(name, value) {\n    name = normalizeName(name);\n    value = normalizeValue(value);\n    var oldValue = this.map[name];\n    this.map[name] = oldValue ? oldValue + ', ' + value : value;\n  };\n\n  Headers.prototype['delete'] = function(name) {\n    delete this.map[normalizeName(name)];\n  };\n\n  Headers.prototype.get = function(name) {\n    name = normalizeName(name);\n    return this.has(name) ? this.map[name] : null\n  };\n\n  Headers.prototype.has = function(name) {\n    return this.map.hasOwnProperty(normalizeName(name))\n  };\n\n  Headers.prototype.set = function(name, value) {\n    this.map[normalizeName(name)] = normalizeValue(value);\n  };\n\n  Headers.prototype.forEach = function(callback, thisArg) {\n    for (var name in this.map) {\n      if (this.map.hasOwnProperty(name)) {\n        callback.call(thisArg, this.map[name], name, this);\n      }\n    }\n  };\n\n  Headers.prototype.keys = function() {\n    var items = [];\n    this.forEach(function(value, name) {\n      items.push(name);\n    });\n    return iteratorFor(items)\n  };\n\n  Headers.prototype.values = function() {\n    var items = [];\n    this.forEach(function(value) {\n      items.push(value);\n    });\n    return iteratorFor(items)\n  };\n\n  Headers.prototype.entries = function() {\n    var items = [];\n    this.forEach(function(value, name) {\n      items.push([name, value]);\n    });\n    return iteratorFor(items)\n  };\n\n  if (support.iterable) {\n    Headers.prototype[Symbol.iterator] = Headers.prototype.entries;\n  }\n\n  function consumed(body) {\n    if (body.bodyUsed) {\n      return Promise.reject(new TypeError('Already read'))\n    }\n    body.bodyUsed = true;\n  }\n\n  function fileReaderReady(reader) {\n    return new Promise(function(resolve, reject) {\n      reader.onload = function() {\n        resolve(reader.result);\n      };\n      reader.onerror = function() {\n        reject(reader.error);\n      };\n    })\n  }\n\n  function readBlobAsArrayBuffer(blob) {\n    var reader = new FileReader();\n    var promise = fileReaderReady(reader);\n    reader.readAsArrayBuffer(blob);\n    return promise\n  }\n\n  function readBlobAsText(blob) {\n    var reader = new FileReader();\n    var promise = fileReaderReady(reader);\n    reader.readAsText(blob);\n    return promise\n  }\n\n  function readArrayBufferAsText(buf) {\n    var view = new Uint8Array(buf);\n    var chars = new Array(view.length);\n\n    for (var i = 0; i < view.length; i++) {\n      chars[i] = String.fromCharCode(view[i]);\n    }\n    return chars.join('')\n  }\n\n  function bufferClone(buf) {\n    if (buf.slice) {\n      return buf.slice(0)\n    } else {\n      var view = new Uint8Array(buf.byteLength);\n      view.set(new Uint8Array(buf));\n      return view.buffer\n    }\n  }\n\n  function Body() {\n    this.bodyUsed = false;\n\n    this._initBody = function(body) {\n      this._bodyInit = body;\n      if (!body) {\n        this._bodyText = '';\n      } else if (typeof body === 'string') {\n        this._bodyText = body;\n      } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n        this._bodyBlob = body;\n      } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n        this._bodyFormData = body;\n      } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n        this._bodyText = body.toString();\n      } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n        this._bodyArrayBuffer = bufferClone(body.buffer);\n        // IE 10-11 can't handle a DataView body.\n        this._bodyInit = new Blob([this._bodyArrayBuffer]);\n      } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n        this._bodyArrayBuffer = bufferClone(body);\n      } else {\n        this._bodyText = body = Object.prototype.toString.call(body);\n      }\n\n      if (!this.headers.get('content-type')) {\n        if (typeof body === 'string') {\n          this.headers.set('content-type', 'text/plain;charset=UTF-8');\n        } else if (this._bodyBlob && this._bodyBlob.type) {\n          this.headers.set('content-type', this._bodyBlob.type);\n        } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n          this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n        }\n      }\n    };\n\n    if (support.blob) {\n      this.blob = function() {\n        var rejected = consumed(this);\n        if (rejected) {\n          return rejected\n        }\n\n        if (this._bodyBlob) {\n          return Promise.resolve(this._bodyBlob)\n        } else if (this._bodyArrayBuffer) {\n          return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n        } else if (this._bodyFormData) {\n          throw new Error('could not read FormData body as blob')\n        } else {\n          return Promise.resolve(new Blob([this._bodyText]))\n        }\n      };\n\n      this.arrayBuffer = function() {\n        if (this._bodyArrayBuffer) {\n          return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n        } else {\n          return this.blob().then(readBlobAsArrayBuffer)\n        }\n      };\n    }\n\n    this.text = function() {\n      var rejected = consumed(this);\n      if (rejected) {\n        return rejected\n      }\n\n      if (this._bodyBlob) {\n        return readBlobAsText(this._bodyBlob)\n      } else if (this._bodyArrayBuffer) {\n        return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n      } else if (this._bodyFormData) {\n        throw new Error('could not read FormData body as text')\n      } else {\n        return Promise.resolve(this._bodyText)\n      }\n    };\n\n    if (support.formData) {\n      this.formData = function() {\n        return this.text().then(decode)\n      };\n    }\n\n    this.json = function() {\n      return this.text().then(JSON.parse)\n    };\n\n    return this\n  }\n\n  // HTTP methods whose capitalization should be normalized\n  var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];\n\n  function normalizeMethod(method) {\n    var upcased = method.toUpperCase();\n    return methods.indexOf(upcased) > -1 ? upcased : method\n  }\n\n  function Request(input, options) {\n    options = options || {};\n    var body = options.body;\n\n    if (input instanceof Request) {\n      if (input.bodyUsed) {\n        throw new TypeError('Already read')\n      }\n      this.url = input.url;\n      this.credentials = input.credentials;\n      if (!options.headers) {\n        this.headers = new Headers(input.headers);\n      }\n      this.method = input.method;\n      this.mode = input.mode;\n      this.signal = input.signal;\n      if (!body && input._bodyInit != null) {\n        body = input._bodyInit;\n        input.bodyUsed = true;\n      }\n    } else {\n      this.url = String(input);\n    }\n\n    this.credentials = options.credentials || this.credentials || 'same-origin';\n    if (options.headers || !this.headers) {\n      this.headers = new Headers(options.headers);\n    }\n    this.method = normalizeMethod(options.method || this.method || 'GET');\n    this.mode = options.mode || this.mode || null;\n    this.signal = options.signal || this.signal;\n    this.referrer = null;\n\n    if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n      throw new TypeError('Body not allowed for GET or HEAD requests')\n    }\n    this._initBody(body);\n  }\n\n  Request.prototype.clone = function() {\n    return new Request(this, {body: this._bodyInit})\n  };\n\n  function decode(body) {\n    var form = new FormData();\n    body\n      .trim()\n      .split('&')\n      .forEach(function(bytes) {\n        if (bytes) {\n          var split = bytes.split('=');\n          var name = split.shift().replace(/\\+/g, ' ');\n          var value = split.join('=').replace(/\\+/g, ' ');\n          form.append(decodeURIComponent(name), decodeURIComponent(value));\n        }\n      });\n    return form\n  }\n\n  function parseHeaders(rawHeaders) {\n    var headers = new Headers();\n    // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n    // https://tools.ietf.org/html/rfc7230#section-3.2\n    var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ');\n    preProcessedHeaders.split(/\\r?\\n/).forEach(function(line) {\n      var parts = line.split(':');\n      var key = parts.shift().trim();\n      if (key) {\n        var value = parts.join(':').trim();\n        headers.append(key, value);\n      }\n    });\n    return headers\n  }\n\n  Body.call(Request.prototype);\n\n  function Response(bodyInit, options) {\n    if (!options) {\n      options = {};\n    }\n\n    this.type = 'default';\n    this.status = options.status === undefined ? 200 : options.status;\n    this.ok = this.status >= 200 && this.status < 300;\n    this.statusText = 'statusText' in options ? options.statusText : 'OK';\n    this.headers = new Headers(options.headers);\n    this.url = options.url || '';\n    this._initBody(bodyInit);\n  }\n\n  Body.call(Response.prototype);\n\n  Response.prototype.clone = function() {\n    return new Response(this._bodyInit, {\n      status: this.status,\n      statusText: this.statusText,\n      headers: new Headers(this.headers),\n      url: this.url\n    })\n  };\n\n  Response.error = function() {\n    var response = new Response(null, {status: 0, statusText: ''});\n    response.type = 'error';\n    return response\n  };\n\n  var redirectStatuses = [301, 302, 303, 307, 308];\n\n  Response.redirect = function(url, status) {\n    if (redirectStatuses.indexOf(status) === -1) {\n      throw new RangeError('Invalid status code')\n    }\n\n    return new Response(null, {status: status, headers: {location: url}})\n  };\n\n  exports.DOMException = self.DOMException;\n  try {\n    new exports.DOMException();\n  } catch (err) {\n    exports.DOMException = function(message, name) {\n      this.message = message;\n      this.name = name;\n      var error = Error(message);\n      this.stack = error.stack;\n    };\n    exports.DOMException.prototype = Object.create(Error.prototype);\n    exports.DOMException.prototype.constructor = exports.DOMException;\n  }\n\n  function fetch(input, init) {\n    return new Promise(function(resolve, reject) {\n      var request = new Request(input, init);\n\n      if (request.signal && request.signal.aborted) {\n        return reject(new exports.DOMException('Aborted', 'AbortError'))\n      }\n\n      var xhr = new XMLHttpRequest();\n\n      function abortXhr() {\n        xhr.abort();\n      }\n\n      xhr.onload = function() {\n        var options = {\n          status: xhr.status,\n          statusText: xhr.statusText,\n          headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n        };\n        options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');\n        var body = 'response' in xhr ? xhr.response : xhr.responseText;\n        resolve(new Response(body, options));\n      };\n\n      xhr.onerror = function() {\n        reject(new TypeError('Network request failed'));\n      };\n\n      xhr.ontimeout = function() {\n        reject(new TypeError('Network request failed'));\n      };\n\n      xhr.onabort = function() {\n        reject(new exports.DOMException('Aborted', 'AbortError'));\n      };\n\n      xhr.open(request.method, request.url, true);\n\n      if (request.credentials === 'include') {\n        xhr.withCredentials = true;\n      } else if (request.credentials === 'omit') {\n        xhr.withCredentials = false;\n      }\n\n      if ('responseType' in xhr && support.blob) {\n        xhr.responseType = 'blob';\n      }\n\n      request.headers.forEach(function(value, name) {\n        xhr.setRequestHeader(name, value);\n      });\n\n      if (request.signal) {\n        request.signal.addEventListener('abort', abortXhr);\n\n        xhr.onreadystatechange = function() {\n          // DONE (success or failure)\n          if (xhr.readyState === 4) {\n            request.signal.removeEventListener('abort', abortXhr);\n          }\n        };\n      }\n\n      xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);\n    })\n  }\n\n  fetch.polyfill = true;\n\n  if (!self.fetch) {\n    self.fetch = fetch;\n    self.Headers = Headers;\n    self.Request = Request;\n    self.Response = Response;\n  }\n\n  exports.Headers = Headers;\n  exports.Request = Request;\n  exports.Response = Response;\n  exports.fetch = fetch;\n\n  Object.defineProperty(exports, '__esModule', { value: true });\n\n  return exports;\n\n})({});\n})(__self__);\n__self__.fetch.ponyfill = true;\n// Remove \"polyfill\" property added by whatwg-fetch\ndelete __self__.fetch.polyfill;\n// Choose between native implementation (global) or custom implementation (__self__)\n// var ctx = global.fetch ? global : __self__;\nvar ctx = __self__; // this line disable service worker support temporarily\nexports = ctx.fetch // To enable: import fetch from 'cross-fetch'\nexports.default = ctx.fetch // For TypeScript consumers without esModuleInterop.\nexports.fetch = ctx.fetch // To enable: import {fetch} from 'cross-fetch'\nexports.Headers = ctx.Headers\nexports.Request = ctx.Request\nexports.Response = ctx.Response\nmodule.exports = exports\n\n\n/***/ }),\n\n/***/ \"./src/isNullResponse.js\":\n/*!*******************************!*\\\n  !*** ./src/isNullResponse.js ***!\n  \\*******************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\n/**\n * @param {Response} response the response from fetch()\n * @returns {boolean} true if the response is a \"null response\" where we successfully talked to the\n * source, but the source has no data for us.\n */\nconst isNullResponse = response =>\n// can't access, eg. due to expired/missing project token\nresponse.status === 403 ||\n// assets does not exist\n// assets.scratch.mit.edu also returns 503 for missing assets\nresponse.status === 404 || response.status === 503;\nmodule.exports = isNullResponse;\n\n/***/ }),\n\n/***/ \"./src/safer-fetch.js\":\n/*!****************************!*\\\n  !*** ./src/safer-fetch.js ***!\n  \\****************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n/* eslint-disable no-use-before-define */\n\nconst {\n  scratchFetch\n} = __webpack_require__(/*! ./scratchFetch */ \"./src/scratchFetch.js\");\n\n// This throttles and retries scratchFetch() to mitigate the effect of random network errors and\n// random browser errors (especially in Chrome)\n\nlet currentFetches = 0;\nconst queue = [];\nconst sleep = ms => new Promise(resolve => setTimeout(resolve, ms));\nconst startNextFetch = _ref => {\n  let [resolve, url, options] = _ref;\n  let failedAttempts = 0;\n\n  /**\n   * @param {Response} result From fetch()\n   */\n  const done = result => {\n    // In macOS WKWebView, requests to file:// URLs return status: 0 and ok: false when they succeed, so we'll\n    // mess with the object so everyone that uses this realizes it succeeded.\n    // If the requests failed (because the file didn't exist) then fetch() rejects instead.\n    if (result.status === 0) {\n      Object.defineProperty(result, 'ok', {\n        value: true\n      });\n      Object.defineProperty(result, 'status', {\n        value: 200\n      });\n    }\n    currentFetches--;\n    checkStartNextFetch();\n    resolve(result);\n  };\n  const attemptToFetch = () => scratchFetch(url, options).then(done).catch(error => {\n    // If fetch() errors, it means there was a network error of some sort.\n    // This is worth retrying, especially as some browser will randomly fail requests\n    // if we send too many at once (as we do).\n\n    console.warn(\"Attempt to fetch \".concat(url, \" failed\"), error);\n    if (failedAttempts < 2) {\n      failedAttempts++;\n      sleep((failedAttempts + Math.random() - 1) * 5000).then(attemptToFetch);\n      return;\n    }\n\n    // The fetch() error is usually very generic, so we'll add enough information\n    // to possibly be useful.\n    done(Promise.reject(new Error(\"Storage request \".concat(url, \" failed: \").concat(error))));\n  });\n  attemptToFetch();\n};\nconst checkStartNextFetch = () => {\n  if (currentFetches < 100 && queue.length > 0) {\n    currentFetches++;\n    startNextFetch(queue.shift());\n  }\n};\nconst saferFetch = (url, options) => new Promise(resolve => {\n  queue.push([resolve, url, options]);\n  checkStartNextFetch();\n});\nmodule.exports = saferFetch;\n\n/***/ }),\n\n/***/ \"./src/scratchFetch.js\":\n/*!*****************************!*\\\n  !*** ./src/scratchFetch.js ***!\n  \\*****************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nconst crossFetch = __webpack_require__(/*! cross-fetch */ \"./node_modules/cross-fetch/dist/browser-ponyfill.js\");\n\n/**\n * Metadata header names\n * @enum {string} The enum value is the name of the associated header.\n * @readonly\n */\nconst RequestMetadata = {\n  /** The ID of the project associated with this request */\n  ProjectId: 'X-Project-ID',\n  /** The ID of the project run associated with this request */\n  RunId: 'X-Run-ID'\n};\n\n/**\n * Metadata headers for requests\n * @type {Headers}\n */\nconst metadata = new crossFetch.Headers();\n\n/**\n * Check if there is any metadata to apply.\n * @returns {boolean} true if `metadata` has contents, or false if it is empty.\n */\nconst hasMetadata = () => {\n  /* global self */\n  const searchParams = typeof self !== 'undefined' && self && self.location && self.location.search && self.location.search.split(/[?&]/) || [];\n  if (!searchParams.includes('scratchMetadata=1')) {\n    // for now, disable this feature unless scratchMetadata=1\n    // TODO: remove this check once we're sure the feature works correctly in production\n    return false;\n  }\n  for (const _ of metadata) {\n    return true;\n  }\n  return false;\n};\n\n/**\n * Non-destructively merge any metadata state (if any) with the provided options object (if any).\n * If there is metadata state but no options object is provided, make a new object.\n * If there is no metadata state, return the provided options parameter without modification.\n * If there is metadata and an options object is provided, modify a copy and return it.\n * Headers in the provided options object may override headers generated from metadata state.\n * @param {RequestInit} [options] The initial request options. May be null or undefined.\n * @returns {RequestInit|undefined} the provided options parameter without modification, or a new options object.\n */\nconst applyMetadata = options => {\n  if (hasMetadata()) {\n    const augmentedOptions = Object.assign({}, options);\n    augmentedOptions.headers = new crossFetch.Headers(metadata);\n    if (options && options.headers) {\n      // the Fetch spec says options.headers could be:\n      // \"A Headers object, an object literal, or an array of two-item arrays to set request's headers.\"\n      // turn it into a Headers object to be sure of how to interact with it\n      const overrideHeaders = options.headers instanceof crossFetch.Headers ? options.headers : new crossFetch.Headers(options.headers);\n      for (const [name, value] of overrideHeaders.entries()) {\n        augmentedOptions.headers.set(name, value);\n      }\n    }\n    return augmentedOptions;\n  }\n  return options;\n};\n\n/**\n * Make a network request.\n * This is a wrapper for the global fetch method, adding some Scratch-specific functionality.\n * @param {RequestInfo|URL} resource The resource to fetch.\n * @param {RequestInit} options Optional object containing custom settings for this request.\n * @see {@link https://developer.mozilla.org/docs/Web/API/fetch} for more about the fetch API.\n * @returns {Promise<Response>} A promise for the response to the request.\n */\nconst scratchFetch = (resource, options) => {\n  const augmentedOptions = applyMetadata(options);\n  return crossFetch.fetch(resource, augmentedOptions);\n};\n\n/**\n * Set the value of a named request metadata item.\n * Setting the value to `null` or `undefined` will NOT remove the item.\n * Use `unsetMetadata` for that.\n * @param {RequestMetadata} name The name of the metadata item to set.\n * @param {any} value The value to set (will be converted to a string).\n */\nconst setMetadata = (name, value) => {\n  metadata.set(name, value);\n};\n\n/**\n * Remove a named request metadata item.\n * @param {RequestMetadata} name The name of the metadata item to remove.\n */\nconst unsetMetadata = name => {\n  metadata.delete(name);\n};\nmodule.exports = {\n  default: scratchFetch,\n  Headers: crossFetch.Headers,\n  RequestMetadata,\n  applyMetadata,\n  scratchFetch,\n  setMetadata,\n  unsetMetadata\n};\nif (true) {\n  /**\n   * Retrieve a named request metadata item.\n   * Only for use in tests.\n   * @param {RequestMetadata} name The name of the metadata item to retrieve.\n   * @returns {any} value The value of the metadata item, or `undefined` if it was not found.\n   */\n  const getMetadata = name => metadata.get(name);\n  module.exports.getMetadata = getMetadata;\n}\n\n/***/ })\n\n/******/ });\n//# sourceMappingURL=3385fc4f5b394e2b375c.worker.js.map",n.p+"3385fc4f5b394e2b375c.worker.js")}},"./node_modules/worker-loader/dist/workers/InlineWorker.js":function(t,e,n){"use strict";var r=window.URL||window.webkitURL;t.exports=function(t,e){try{try{var n;try{(n=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)).append(t),n=n.getBlob()}catch(e){n=new Blob([t])}return new Worker(r.createObjectURL(n))}catch(e){return new Worker("data:application/javascript,"+encodeURIComponent(t))}}catch(t){if(!e)throw Error("Inline worker is not supported");return new Worker(e)}}},"./src/Asset.js":function(t,e,n){const r=n("./node_modules/js-md5/src/md5.js");let i=null;const s={},o={},a="function"==typeof FinalizationRegistry?new FinalizationRegistry((t=>{const e=o[t];1===e?(delete o[t],delete s[t]):o[t]=e-1})):null,c=a?t=>{const e=t.assetId,n=o[e]||0;o[e]=n+1,a.register(t,e)}:()=>{};t.exports=class{constructor(t,e,n,r,i){this.assetType=t,this.assetId=e,this.setData(r,n||t.runtimeFormat,i),this.dependencies=[],c(this)}setData(t,e,n){if(t&&!e)throw new Error("Data provided without specifying its format");this.dataFormat=e,this.data=t,n&&(this.assetId=r(t)),this.clean=!n}decodeText(){return(new TextDecoder).decode(this.data)}encodeTextData(t,e,n){const r=new TextEncoder;this.setData(r.encode(t),e,n)}encodeDataURI(t){return t=t||this.assetType.contentType,"data:".concat(t,";base64,").concat(((t,e)=>{if(!Object.prototype.hasOwnProperty.call(s,t))if("undefined"==typeof btoa){const r=n("./node_modules/base64-js/index.js");s[t]=r.fromByteArray(e)}else{if(null===i){i=new Array(256);for(let t=0;t<256;t++)i[t]=String.fromCharCode(t)}const{length:n}=e;let r="";for(let t=0,s=0;t<n;t=s){s=Math.min(s+32766,n);let o="";for(let n=t;n<s;n+=1)o+=i[e[n]];r+=btoa(o)}s[t]=r}return s[t]})(this.assetId,this.data))}}},"./src/AssetType.js":function(t,e,n){const r=n("./src/DataFormat.js"),i={ImageBitmap:{contentType:"image/png",name:"ImageBitmap",runtimeFormat:r.PNG,immutable:!0},ImageVector:{contentType:"image/svg+xml",name:"ImageVector",runtimeFormat:r.SVG,immutable:!0},Project:{contentType:"application/json",name:"Project",runtimeFormat:r.JSON,immutable:!1},Sound:{contentType:"audio/x-wav",name:"Sound",runtimeFormat:r.WAV,immutable:!0},Sprite:{contentType:"application/json",name:"Sprite",runtimeFormat:r.JSON,immutable:!0},Font:{contentType:"font/ttf",name:"Font",runtimeFormat:r.TTF,immutable:!0}};t.exports=i},"./src/BuiltinHelper.js":function(t,e,n){(function(e){const r=n("./node_modules/js-md5/src/md5.js"),i=n("./src/Asset.js"),s=n("./src/AssetType.js"),o=n("./src/DataFormat.js"),a=n("./src/Helper.js"),c=[{type:s.ImageBitmap,format:o.PNG,id:null,data:e.from(n("./src/builtins/defaultBitmap.png"))},{type:s.Sound,format:o.WAV,id:null,data:e.from(n("./src/builtins/defaultSound.wav"))},{type:s.ImageVector,format:o.SVG,id:null,data:e.from(n("./src/builtins/defaultVector.svg"))}],u=c.concat([]);t.exports=class extends a{constructor(t){super(t),this.assets={},u.forEach((t=>{t.id=this._store(t.type,t.format,t.data,t.id)}))}registerDefaultAssets(){const t=c.length;for(let e=0;e<t;++e){const t=c[e];this.parent.setDefaultAssetId(t.type,t.id)}}get(t){let e=null;if(Object.prototype.hasOwnProperty.call(this.assets,t)){const n=this.assets[t];e=new i(n.type,n.id,n.format,n.data)}return e}cache(t,e,n,r){return this.store(t,e,n,r)}store(t,e,n,r){return this._store(t,e,n,r)}_store(t,e,n,i){if(!e)throw new Error("Data cached without specifying its format");if(""!==i&&null!=i){if(Object.prototype.hasOwnProperty.call(this.assets,i)&&t.immutable)return i}else{if(!t.immutable)throw new Error("Tried to cache data without an id");i=r(n)}return this.assets[i]={type:t,format:e,id:i,data:n},i}load(t,e){return this.get(e)?Promise.resolve(this.get(e)):null}}}).call(this,n("./node_modules/node-libs-browser/node_modules/buffer/index.js").Buffer)},"./src/DataFormat.js":function(t,e){t.exports={JPG:"jpg",JSON:"json",MP3:"mp3",PNG:"png",SB2:"sb2",SB3:"sb3",SVG:"svg",WAV:"wav",TTF:"ttf",OTF:"otf",WOFF:"woff",WOFF2:"woff2"}},"./src/FetchTool.js":function(t,e,n){var r=n("./node_modules/@babel/runtime/helpers/objectWithoutProperties.js");const i=["url"],s=["url","withCredentials"],{scratchFetch:o}=n("./src/scratchFetch.js"),a=n("./src/safer-fetch.js"),c=n("./src/isNullResponse.js");t.exports=class{get isGetSupported(){return!0}get(t){let{url:e}=t,n=r(t,i);return a(e,Object.assign({method:"GET"},n)).then((t=>t.ok?t.arrayBuffer().then((t=>new Uint8Array(t))):c(t)?null:Promise.reject(t.status)))}get isSendSupported(){return!0}send(t){let{url:e,withCredentials:n=!1}=t,i=r(t,s);return o(e,Object.assign({credentials:n?"include":"omit"},i)).then((t=>t.ok?t.text():Promise.reject(t.status)))}}},"./src/FetchWorkerTool.js":function(t,e,n){var r=n("./node_modules/@babel/runtime/helpers/objectWithoutProperties.js");const i=["url"],{Headers:s,applyMetadata:o}=n("./src/scratchFetch.js");class a{constructor(){this._workerSupport={fetch:"undefined"!=typeof fetch},this._supportError=null,this.worker=null,this.jobs={};try{if(this.isGetSupported){const t=new(n('./node_modules/worker-loader/dist/cjs.js?{"inline":true,"fallback":true}!./src/FetchWorkerTool.worker.js'));t.addEventListener("message",(t=>{let{data:e}=t;if(e.support)this._workerSupport=e.support;else for(const t of e)this.jobs[t.id]&&(t.error?this.jobs[t.id].reject(t.error):this.jobs[t.id].resolve(t.buffer),delete this.jobs[t.id])})),this.worker=t}}catch(t){this._supportError=t}}get isGetSupported(){return"undefined"!=typeof Worker&&this._workerSupport.fetch&&!this._supportError}get(t){let{url:e}=t,n=r(t,i);return new Promise(((t,r)=>{const i=Math.random().toString(16).substring(2),a=o(Object.assign({method:"GET"},n));a&&a.headers instanceof s&&(a.headers=Array.from(a.headers.entries())),this.worker.postMessage({id:i,url:e,options:a}),this.jobs[i]={id:i,resolve:t,reject:r}})).then((t=>t?new Uint8Array(t):null))}get isSendSupported(){return!1}send(){throw new Error("Not implemented.")}static get instance(){return this._instance||(this._instance=new a),this._instance}}t.exports=class{constructor(){this.inner=a.instance}get isGetSupported(){return this.inner.isGetSupported}get(t){return this.inner.get(t)}get isSendSupported(){return!1}send(){throw new Error("Not implemented.")}}},"./src/Helper.js":function(t,e){t.exports=class{constructor(t){this.parent=t}load(t,e,n){return Promise.reject(new Error("No asset of type ".concat(t," for ID ").concat(e," with format ").concat(n)))}}},"./src/ProxyTool.js":function(t,e,n){const r=n("./src/FetchWorkerTool.js"),i=n("./src/FetchTool.js");class s{constructor(){let t;t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:s.TOOL_FILTER.ALL)===s.TOOL_FILTER.READY?[new i]:[new r,new i],this.tools=t}get isGetSupported(){return this.tools.some((t=>t.isGetSupported))}get(t){let e=0;const n=r=>{const i=this.tools[e++];if(!i)throw r;return i.isGetSupported?i.get(t).catch(n):n(r)};return n()}get isSendSupported(){return this.tools.some((t=>t.isSendSupported))}send(t){let e=0;const n=r=>{const i=this.tools[e++];if(!i)throw r;return i.isSendSupported?i.send(t).catch(n):n(r)};return n()}}s.TOOL_FILTER={ALL:"all",READY:"ready"},t.exports=s},"./src/ScratchStorage.js":function(t,e,n){const r=n("./src/BuiltinHelper.js"),i=n("./src/WebHelper.js"),s=n("./src/Asset.js"),o=n("./src/AssetType.js"),a=n("./src/DataFormat.js"),c=n("./src/scratchFetch.js");t.exports=class{constructor(){this.defaultAssetId={},this.builtinHelper=new r(this),this.webHelper=new i(this),this.builtinHelper.registerDefaultAssets(this),this._helpers=[{helper:this.builtinHelper,priority:100},{helper:this.webHelper,priority:-100}]}get Asset(){return s}get AssetType(){return o}get DataFormat(){return a}get scratchFetch(){return c}static get Asset(){return s}static get AssetType(){return o}addHelper(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this._helpers.push({helper:t,priority:e}),this._helpers.sort(((t,e)=>e.priority-t.priority))}get(t){return this.builtinHelper.get(t)}cache(t,e,n,r){return this.builtinHelper._store(t,e,n,r)}createAsset(t,e,n,r,i){if(!e)throw new Error("Tried to create asset without a dataFormat");return new s(t,r,e,n,i)}addWebStore(t,e,n,r){this.webHelper.addStore(t,e,n,r)}addWebSource(t,e){this.addWebStore(t,e)}getDefaultAssetId(t){if(Object.prototype.hasOwnProperty.call(this.defaultAssetId,t.name))return this.defaultAssetId[t.name]}setDefaultAssetId(t,e){this.defaultAssetId[t.name]=e}load(t,e,n){const r=this._helpers.map((t=>t.helper)),i=[];n=n||t.runtimeFormat;let s,o=0;const a=c=>{if(c&&i.push(c),s=r[o++],s){const r=s.load(t,e,n);return null===r?a():r.catch(a)}return i.length>0?Promise.reject(i):Promise.resolve(null)};return a()}store(t,e,n,r){return e=e||t.runtimeFormat,new Promise(((i,s)=>this.webHelper.store(t,e,n,r).then((r=>(this.builtinHelper._store(t,e,n,r.id),i(r)))).catch((t=>s(t)))))}}},"./src/WebHelper.js":function(t,e,n){const r=n("./src/Asset.js"),i=n("./src/Helper.js"),s=n("./src/ProxyTool.js"),o=t=>"string"==typeof t?{url:t}:t;t.exports=class extends i{constructor(t){super(t),this.stores=[],this.assetTool=new s,this.projectTool=new s(s.TOOL_FILTER.READY)}addSource(t,e){this.addStore(t,e)}addStore(t,e,n,r){this.stores.push({types:t.map((t=>t.name)),get:e,create:n,update:r})}load(t,e,n){const i=[],s=this.stores.slice().filter((e=>e.types.indexOf(t.name)>=0)),a=new r(t,e,n);let c=this.assetTool;"Project"===t.name&&(c=this.projectTool);let u=0;const l=t=>{t&&i.push(t);const e=s[u++],r=e&&e.get;if(r){const t=o(r(a));return!1===t?l():c.get(t).then((t=>t?(a.setData(t,n),a):l())).catch(l)}return i.length>0?Promise.reject(i):Promise.resolve(null)};return l()}store(t,e,n,i){const s=new r(t,i,e),a=""===i||null==i,c=this.stores.filter((e=>-1!==e.types.indexOf(t.name)&&(a&&e.create||e.update)))[0],u=a?"post":"put";if(!c)return Promise.reject(new Error("No appropriate stores"));let l=this.assetTool;"Project"===t.name&&(l=this.projectTool);const h=o(a?c.create(s):c.update(s)),d=Object.assign({body:n,method:u},h);return l.send(d).then((t=>{if("string"==typeof t)try{t=JSON.parse(t)}catch(e){return t}return Object.assign({id:t["content-name"]||i},t)}))}}},"./src/builtins/defaultBitmap.png":function(t,e,n){t.exports=n("./node_modules/arraybuffer-loader/lib/to-array-buffer.js")("iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAAAAADmVT4XAAADZElEQVR42u3a70vbQBgH8O/7vOibvsmbFUEEWUGGUhQ25nDuhSKIUFDxlYi0SAd94atRmFiHCH2x4W8iiNtwowXRgd1QipJYY3N/1F4kTQ6XLKS9yyHcvWyO8MnT5y53Tw5EcIMESIAESIAESIAESIAEPFVAq/6l8G4oAQCp4aniwbUVJ6BVzafwqKXy1VZMgNb+CHzbyK4ZB+Bi0nnk0VyhsDiSoAmvvnMHmGUVAF6UG+0ffsxRhsRHky/AyCsAUpumX0wAAIs6T4CxDADDtcdZsal6gjmdH8AsAEC6+s8Fa48SFExeAKusAEju+V367AmUCi9ANQ0AU3pwcOw2cMEH0FwAAKz5X228pRLR5AI4TgIAtIDL24oLUE94AB6W7LsH/cONN14Ilh44AOqD9s2LQR1KHiB9zgGgOSGeuA3ocPrME1Q4ANaceyePAzrcjHmAZYs9IBeW4/fzHiAwTCwAgTle9ACZK44ALDT9e6x7gL4aT0BQCHb4AqgA5/1TTOMLoJ7vZSMM0H/GHnCeDnu+CrU8vGYPcN5FADBYD0vCaYPDy+i0p337GSMsS1Z4vA3t9QgAZTt0IuIxFRPSKicAQHlvhk3FXF5GhBByMa8qo/sBO6BarwuYbYrYnFKDYEvE7phKgcxvEQBqnvhgiQCUOgoAO4C3JOS3L/hv23UXxVldBECfcueAqpAa0WGy/QeULREAY6aTXRFDgBuA13+ElOncAERMAGaA9hBQD4gQQHsIRE1AZoD2xrgQS5nOZyHgFKmWDSIG4GRAVidiAE4GRB6AzAB2AKIPQFaA5myHA5AV4ESNugZhC7BLR50lIBPAebrzBGQCKAFQNSIMcDvRTQIwAHxNApM3RBygGK0uyhxwOwGsPAgEnPWj5ycRCNiJtBHlAChGKQVwANzPY+CXSMDNWISiLA9AfRA5IhJQ68UnoQAt+AtOPIBKhJosF8B6UM0yLkAxQk2WCyDX9SiUh1gkQAIkoCuAvjGuquMbuijAtwG7MPL8yBICOHSPk3W8Ne8KcEUdmBi6FADYos+QleIH0N/ogOxd7AD6uAS6WRU8WcBdlgZMG/EnYUlwEpLLoQ4PjzGbiA5UsRMRsbQ+5ziDJmYqJuR6NaMomdXuFuZyPSABEiABEiABEiABEiAc8Bd6VyvCEKGqcQAAAABJRU5ErkJggg==")},"./src/builtins/defaultSound.wav":function(t,e,n){t.exports=n("./node_modules/arraybuffer-loader/lib/to-array-buffer.js")("UklGRiYAAABXQVZFZm10IBAAAAABAAEAIlYAAESsAAACABAAZGF0YQIAAAAAAA==")},"./src/builtins/defaultVector.svg":function(t,e,n){t.exports=n("./node_modules/arraybuffer-loader/lib/to-array-buffer.js")("PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjxzdmcgd2lkdGg9IjEyOCIgaGVpZ2h0PSIxMjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiA8Zz4KICA8cmVjdCBmaWxsPSIjQ0NDIiBoZWlnaHQ9IjEyOCIgd2lkdGg9IjEyOCIvPgogIDx0ZXh0IGZpbGw9ImJsYWNrIiB5PSIxMDciIHg9IjM1LjUiIGZvbnQtc2l6ZT0iMTI4Ij4/PC90ZXh0PgogPC9nPgo8L3N2Zz4K")},"./src/index.js":function(t,e,n){const r=n("./src/ScratchStorage.js");t.exports=r},"./src/isNullResponse.js":function(t,e){t.exports=t=>403===t.status||404===t.status||503===t.status},"./src/safer-fetch.js":function(t,e,n){const{scratchFetch:r}=n("./src/scratchFetch.js");let i=0;const s=[],o=t=>{let[e,n,s]=t,o=0;const c=t=>{0===t.status&&(Object.defineProperty(t,"ok",{value:!0}),Object.defineProperty(t,"status",{value:200})),i--,a(),e(t)},u=()=>r(n,s).then(c).catch((t=>{if(console.warn("Attempt to fetch ".concat(n," failed"),t),o<2)return o++,void(e=5e3*(o+Math.random()-1),new Promise((t=>setTimeout(t,e)))).then(u);var e;c(Promise.reject(new Error("Storage request ".concat(n," failed: ").concat(t))))}));u()},a=()=>{i<100&&s.length>0&&(i++,o(s.shift()))};t.exports=(t,e)=>new Promise((n=>{s.push([n,t,e]),a()}))},"./src/scratchFetch.js":function(t,e,n){const r=n("./node_modules/cross-fetch/dist/browser-ponyfill.js"),i=new r.Headers,s=t=>{if((()=>{if(!("undefined"!=typeof self&&self&&self.location&&self.location.search&&self.location.search.split(/[?&]/)||[]).includes("scratchMetadata=1"))return!1;for(const t of i)return!0;return!1})()){const e=Object.assign({},t);if(e.headers=new r.Headers(i),t&&t.headers){const n=t.headers instanceof r.Headers?t.headers:new r.Headers(t.headers);for(const[t,r]of n.entries())e.headers.set(t,r)}return e}return t},o=(t,e)=>{const n=s(e);return r.fetch(t,n)};t.exports={default:o,Headers:r.Headers,RequestMetadata:{ProjectId:"X-Project-ID",RunId:"X-Run-ID"},applyMetadata:s,scratchFetch:o,setMetadata:(t,e)=>{i.set(t,e)},unsetMetadata:t=>{i.delete(t)}};{const e=t=>i.get(t);t.exports.getMetadata=e}}})},module.exports=factory()},function(t,e,n){const r=n(282);t.exports=r},function(t,e,n){const r=n(50);t.exports=class extends r{get DEFAULT_VALUE(){return 100}get name(){return"volume"}initialize(){this.inputNode=this.audioEngine.audioContext.createGain(),this.outputNode=this.inputNode,this.initialized=!0}_set(t){this.value=t;const{gain:e}=this.outputNode,{currentTime:n,DECAY_DURATION:r}=this.audioEngine;e.linearRampToValueAtTime(t/100,n+r)}dispose(){this.initialized&&(this.outputNode.disconnect(),this.inputNode=null,this.outputNode=null,this.target=null,this.initialized=!1)}}},function(t,e,n){"use strict";var r,i=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},s=function(){var t={};return function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}t[e]=n}return t[e]}}(),o=[];function a(t){for(var e=-1,n=0;n<o.length;n++)if(o[n].identifier===t){e=n;break}return e}function c(t,e){for(var n={},r=[],i=0;i<t.length;i++){var s=t[i],c=e.base?s[0]+e.base:s[0],u=n[c]||0,l="".concat(c," ").concat(u);n[c]=u+1;var h=a(l),d={css:s[1],media:s[2],sourceMap:s[3]};-1!==h?(o[h].references++,o[h].updater(d)):o.push({identifier:l,updater:g(d,e),references:1}),r.push(l)}return r}function u(t){var e=document.createElement("style"),r=t.attributes||{};if(void 0===r.nonce){var i=n.nc;i&&(r.nonce=i)}if(Object.keys(r).forEach((function(t){e.setAttribute(t,r[t])})),"function"==typeof t.insert)t.insert(e);else{var o=s(t.insert||"head");if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(e)}return e}var l,h=(l=[],function(t,e){return l[t]=e,l.filter(Boolean).join("\n")});function d(t,e,n,r){var i=n?"":r.media?"@media ".concat(r.media," {").concat(r.css,"}"):r.css;if(t.styleSheet)t.styleSheet.cssText=h(e,i);else{var s=document.createTextNode(i),o=t.childNodes;o[e]&&t.removeChild(o[e]),o.length?t.insertBefore(s,o[e]):t.appendChild(s)}}function p(t,e,n){var r=n.css,i=n.media,s=n.sourceMap;if(i?t.setAttribute("media",i):t.removeAttribute("media"),s&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),t.styleSheet)t.styleSheet.cssText=r;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(r))}}var f=null,m=0;function g(t,e){var n,r,i;if(e.singleton){var s=m++;n=f||(f=u(e)),r=d.bind(null,n,s,!1),i=d.bind(null,n,s,!0)}else n=u(e),r=p.bind(null,n,e),i=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(n)};return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else i()}}t.exports=function(t,e){(e=e||{}).singleton||"boolean"==typeof e.singleton||(e.singleton=i());var n=c(t=t||[],e);return function(t){if(t=t||[],"[object Array]"===Object.prototype.toString.call(t)){for(var r=0;r<n.length;r++){var i=a(n[r]);o[i].references--}for(var s=c(t,e),u=0;u<n.length;u++){var l=a(n[u]);0===o[l].references&&(o[l].updater(),o.splice(l,1))}n=s}}}},function(t,e,n){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=t(e);return e[2]?"@media ".concat(e[2]," {").concat(n,"}"):n})).join("")},e.i=function(t,n,r){"string"==typeof t&&(t=[[null,t,""]]);var i={};if(r)for(var s=0;s<this.length;s++){var o=this[s][0];null!=o&&(i[o]=!0)}for(var a=0;a<t.length;a++){var c=[].concat(t[a]);r&&i[c[0]]||(n&&(c[2]?c[2]="".concat(n," and ").concat(c[2]):c[2]=n),e.push(c))}},e}},function(t,e,n){"use strict";t.exports=function(t,e){return e||(e={}),"string"!=typeof(t=t&&t.__esModule?t.default:t)?t:(/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),e.hash&&(t+=e.hash),/["'() \t\n]/.test(t)||e.needQuotes?'"'.concat(t.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):t)}},function(t,e,n){"use strict";e.a="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQgMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTIwLjc3MzU5NSA1LjcyODA1MTlhMS4zMDc3Nzc0IDEuMzA3Nzc3NCAwIDAgMC0xLjg1NzA0MyAwTDkuMTczNjEwNSAxNS40ODQwNzFsLTQuMDkzMzQzMi00LjEwNjQyYTEuMzM2NDQ2OCAxLjMzNjQ0NjggMCAxIDAtMS44NTcwNDM5IDEuOTIyNDMybDUuMDIxODY1MSA1LjAyMTg2NmExLjMwNzc3NzQgMS4zMDc3Nzc0IDAgMCAwIDEuODU3MDQ0NSAwTDIwLjc3MzU5NSA3LjY1MDQ4NDdhMS4zMDc3Nzc0IDEuMzA3Nzc3NCAwIDAgMCAwLTEuOTIyNDMyOHoiIGZpbGw9IiNmZmYiLz48L3N2Zz4="},function(t){t.exports=JSON.parse('{"var-x":"x position","var-y":"y position","var-direction":"direction","var-username":"username","var-costume-number":"costume number","var-costume-name":"costume name","var-backdrop-number":"backdrop number","var-backdrop-name":"backdrop name","var-size":"size","var-answer":"answer","var-mousedown":"mouse down?","var-mousex":"mouse x","var-mousey":"mouse y","var-loudness":"loudness","var-timer":"timer","var-dayssince2000":"days since 2000","var-volume":"volume","var-year":"year","var-month":"month","var-date":"date","var-day-of-week":"day of week","var-hour":"hour","var-minute":"minute","var-second":"second","list-empty":"(empty)","list-length":"length {n}","list-import":"import","list-export":"export"}')},function(t,e,n){"use strict";e.byteLength=function(t){var e=c(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){for(var e,n=c(t),r=n[0],o=n[1],a=new s(function(t,e,n){return 3*(e+n)/4-n}(0,r,o)),u=0,l=o>0?r-4:r,h=0;h<l;h+=4)e=i[t.charCodeAt(h)]<<18|i[t.charCodeAt(h+1)]<<12|i[t.charCodeAt(h+2)]<<6|i[t.charCodeAt(h+3)],a[u++]=e>>16&255,a[u++]=e>>8&255,a[u++]=255&e;2===o&&(e=i[t.charCodeAt(h)]<<2|i[t.charCodeAt(h+1)]>>4,a[u++]=255&e);1===o&&(e=i[t.charCodeAt(h)]<<10|i[t.charCodeAt(h+1)]<<4|i[t.charCodeAt(h+2)]>>2,a[u++]=e>>8&255,a[u++]=255&e);return a},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,s=[],o=16383,a=0,c=n-i;a<c;a+=o)s.push(u(t,a,a+o>c?c:a+o));1===i?(e=t[n-1],s.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],s.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return s.join("")};for(var r=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=o[a],i[o.charCodeAt(a)]=a;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function u(t,e,n){for(var i,s,o=[],a=e;a<n;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),o.push(r[(s=i)>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,n,r,i){var s,o,a=8*i-r-1,c=(1<<a)-1,u=c>>1,l=-7,h=n?i-1:0,d=n?-1:1,p=t[e+h];for(h+=d,s=p&(1<<-l)-1,p>>=-l,l+=a;l>0;s=256*s+t[e+h],h+=d,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=r;l>0;o=256*o+t[e+h],h+=d,l-=8);if(0===s)s=1-u;else{if(s===c)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,r),s-=u}return(p?-1:1)*o*Math.pow(2,s-r)},e.write=function(t,e,n,r,i,s){var o,a,c,u=8*s-i-1,l=(1<<u)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:s-1,f=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=l):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),(e+=o+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(o++,c/=2),o+h>=l?(a=0,o=l):o+h>=1?(a=(e*c-1)*Math.pow(2,i),o+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[n+p]=255&a,p+=f,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;t[n+p]=255&o,p+=f,o/=256,u-=8);t[n+p-f]|=128*m}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function s(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new s(i.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new s(i.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n(101),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(8))},function(t,e,n){(function(t,e){!function(t){"use strict";if(!t.setImmediate){var n,r,i,s,o,a=1,c={},u=!1,l=t.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(t);h=h&&h.setTimeout?h:t,"[object process]"==={}.toString.call(t.process)?n=function(t){e.nextTick((function(){p(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((i=new MessageChannel).port1.onmessage=function(t){p(t.data)},n=function(t){i.port2.postMessage(t)}):l&&"onreadystatechange"in l.createElement("script")?(r=l.documentElement,n=function(t){var e=l.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,r.removeChild(e),e=null},r.appendChild(e)}):n=function(t){setTimeout(p,0,t)}:(s="setImmediate$"+Math.random()+"$",o=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&p(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",o,!1):t.attachEvent("onmessage",o),n=function(e){t.postMessage(s+e,"*")}),h.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),r=0;r<e.length;r++)e[r]=arguments[r+1];var i={callback:t,args:e};return c[a]=i,n(a),a++},h.clearImmediate=d}function d(t){delete c[t]}function p(t){if(u)setTimeout(p,0,t);else{var e=c[t];if(e){u=!0;try{!function(t){var e=t.callback,n=t.args;switch(n.length){case 0:e();break;case 1:e(n[0]);break;case 2:e(n[0],n[1]);break;case 3:e(n[0],n[1],n[2]);break;default:e.apply(void 0,n)}}(e)}finally{d(t),u=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n(8),n(35))},function(t,e,n){let r;r="undefined"==typeof TextEncoder?n(18).TextEncoder:TextEncoder;const i=n(17),s=n(19),o=n(16).Buffer,a=n(53),c=n(105),u=n(0),l=n(4),h=n(39),d=n(45),p=n(47),f=n(6),m=n(5),g=n(9),b=n(79),{loadCostume:y}=n(31),{loadSound:v}=n(30),{serializeSounds:w,serializeCostumes:T}=n(248);n(249);const{exportCostume:E}=n(78),A=n(14),k=["_mouse_","_stage_","_edge_","_myself_","_random_"],I=[];m.setup({missingTranslation:"ignore"});t.exports=class extends i{constructor(){super(),this.runtime=new h,a.setService("runtime",(t=>{const e={};return e._refreshExtensionPrimitives=t._refreshExtensionPrimitives.bind(t),e._registerExtensionPrimitives=t._registerExtensionPrimitives.bind(t),e})(this.runtime)).catch((t=>{u.error("Failed to register runtime service: ".concat(JSON.stringify(t)))})),this.editingTarget=null,this._dragTarget=null,this.runtime.on(h.SCRIPT_GLOW_ON,(t=>{this.emit(h.SCRIPT_GLOW_ON,t)})),this.runtime.on(h.SCRIPT_GLOW_OFF,(t=>{this.emit(h.SCRIPT_GLOW_OFF,t)})),this.runtime.on(h.BLOCK_GLOW_ON,(t=>{this.emit(h.BLOCK_GLOW_ON,t)})),this.runtime.on(h.BLOCK_GLOW_OFF,(t=>{this.emit(h.BLOCK_GLOW_OFF,t)})),this.runtime.on(h.PROJECT_START,(()=>{this.emit(h.PROJECT_START)})),this.runtime.on(h.PROJECT_RUN_START,(()=>{this.emit(h.PROJECT_RUN_START)})),this.runtime.on(h.PROJECT_RUN_STOP,(()=>{this.emit(h.PROJECT_RUN_STOP)})),this.runtime.on(h.PROJECT_CHANGED,(()=>{this.emit(h.PROJECT_CHANGED)})),this.runtime.on(h.VISUAL_REPORT,(t=>{this.emit(h.VISUAL_REPORT,t)})),this.runtime.on(h.TARGETS_UPDATE,(t=>{this.emitTargetsUpdate(t)})),this.runtime.on(h.MONITORS_UPDATE,(t=>{this.emit(h.MONITORS_UPDATE,t)})),this.runtime.on(h.BLOCK_DRAG_UPDATE,(t=>{this.emit(h.BLOCK_DRAG_UPDATE,t)})),this.runtime.on(h.BLOCK_DRAG_END,((t,e)=>{this.emit(h.BLOCK_DRAG_END,t,e)})),this.runtime.on(h.EXTENSION_ADDED,(t=>{this.emit(h.EXTENSION_ADDED,t)})),this.runtime.on(h.EXTENSION_FIELD_ADDED,((t,e)=>{this.emit(h.EXTENSION_FIELD_ADDED,t,e)})),this.runtime.on(h.BLOCKSINFO_UPDATE,(t=>{this.emit(h.BLOCKSINFO_UPDATE,t)})),this.runtime.on(h.BLOCKS_NEED_UPDATE,(()=>{this.emitWorkspaceUpdate()})),this.runtime.on(h.TOOLBOX_EXTENSIONS_NEED_UPDATE,(()=>{this.extensionManager.refreshBlocks()})),this.runtime.on(h.PERIPHERAL_LIST_UPDATE,(t=>{this.emit(h.PERIPHERAL_LIST_UPDATE,t)})),this.runtime.on(h.USER_PICKED_PERIPHERAL,(t=>{this.emit(h.USER_PICKED_PERIPHERAL,t)})),this.runtime.on(h.PERIPHERAL_CONNECTED,(()=>this.emit(h.PERIPHERAL_CONNECTED))),this.runtime.on(h.PERIPHERAL_REQUEST_ERROR,(()=>this.emit(h.PERIPHERAL_REQUEST_ERROR))),this.runtime.on(h.PERIPHERAL_DISCONNECTED,(()=>this.emit(h.PERIPHERAL_DISCONNECTED))),this.runtime.on(h.PERIPHERAL_CONNECTION_LOST_ERROR,(t=>this.emit(h.PERIPHERAL_CONNECTION_LOST_ERROR,t))),this.runtime.on(h.PERIPHERAL_SCAN_TIMEOUT,(()=>this.emit(h.PERIPHERAL_SCAN_TIMEOUT))),this.runtime.on(h.MIC_LISTENING,(t=>{this.emit(h.MIC_LISTENING,t)})),this.runtime.on(h.RUNTIME_STARTED,(()=>{this.emit(h.RUNTIME_STARTED)})),this.runtime.on(h.RUNTIME_STOPPED,(()=>{this.emit(h.RUNTIME_STOPPED)})),this.runtime.on(h.HAS_CLOUD_DATA_UPDATE,(t=>{this.emit(h.HAS_CLOUD_DATA_UPDATE,t)})),this.runtime.on(h.RUNTIME_OPTIONS_CHANGED,(t=>{this.emit(h.RUNTIME_OPTIONS_CHANGED,t)})),this.runtime.on(h.COMPILER_OPTIONS_CHANGED,(t=>{this.emit(h.COMPILER_OPTIONS_CHANGED,t)})),this.runtime.on(h.FRAMERATE_CHANGED,(t=>{this.emit(h.FRAMERATE_CHANGED,t)})),this.runtime.on(h.INTERPOLATION_CHANGED,(t=>{this.emit(h.INTERPOLATION_CHANGED,t)})),this.runtime.on(h.STAGE_SIZE_CHANGED,((t,e)=>{this.emit(h.STAGE_SIZE_CHANGED,t,e)})),this.runtime.on(h.COMPILE_ERROR,((t,e)=>{this.emit(h.COMPILE_ERROR,t,e)})),this.runtime.on(h.ASSET_PROGRESS,((t,e)=>{this.emit(h.ASSET_PROGRESS,t,e)})),this.runtime.on(h.TURBO_MODE_OFF,(()=>{this.emit(h.TURBO_MODE_OFF)})),this.runtime.on(h.TURBO_MODE_ON,(()=>{this.emit(h.TURBO_MODE_ON)})),this.extensionManager=new c(this),this.securityManager=this.extensionManager.securityManager,this.runtime.extensionManager=this.extensionManager;for(const t of I)this.extensionManager.loadExtensionIdSync(t);this.blockListener=this.blockListener.bind(this),this.flyoutBlockListener=this.flyoutBlockListener.bind(this),this.monitorBlockListener=this.monitorBlockListener.bind(this),this.variableListener=this.variableListener.bind(this),this.exports={Sprite:p,RenderedTarget:d,JSZip:s,Variable:g,i_will_not_ask_for_help_when_these_break:()=>(console.warn("You are using unsupported APIs. WHEN your code breaks, do not expect help."),{JSGenerator:n(66),IRGenerator:n(42).IRGenerator,ScriptTreeGenerator:n(42).ScriptTreeGenerator,Thread:n(22),execute:n(44)})}}start(){this.runtime.start()}stop(){this.quit()}quit(){this.runtime.quit()}greenFlag(){this.runtime.greenFlag()}setTurboMode(t){this.runtime.turboMode=!!t,this.runtime.turboMode?this.emit(h.TURBO_MODE_ON):this.emit(h.TURBO_MODE_OFF)}setCompatibilityMode(t){this.runtime.setCompatibilityMode(!!t)}setFramerate(t){this.runtime.setFramerate(t)}setInterpolation(t){this.runtime.setInterpolation(t)}setRuntimeOptions(t){this.runtime.setRuntimeOptions(t)}setCompilerOptions(t){this.runtime.setCompilerOptions(t)}setStageSize(t,e){this.runtime.setStageSize(t,e)}setInEditor(t){this.runtime.setInEditor(t)}convertToPackagedRuntime(){this.runtime.convertToPackagedRuntime()}addAddonBlock(t){this.runtime.addAddonBlock(t)}getAddonBlock(t){return this.runtime.getAddonBlock(t)}storeProjectOptions(){this.runtime.storeProjectOptions(),this.editingTarget.isStage&&this.emitWorkspaceUpdate()}enableDebug(){return this.runtime.enableDebug(),"enabled debug mode"}handleExtensionButtonPress(t){this.runtime.handleExtensionButtonPress(t)}stopAll(){this.runtime.stopAll()}clear(){this.runtime.dispose(),this.editingTarget=null,this.emitTargetsUpdate(!1)}getPlaygroundData(){const t=this,e=this.runtime.threads.filter((e=>e.target===t.editingTarget)),n=JSON.stringify(e,((t,e)=>{if("target"!==t&&"blockContainer"!==t)return e}),2);this.emit("playgroundData",{blocks:this.editingTarget.blocks,threads:n})}postIOData(t,e){this.runtime.ioDevices[t]&&this.runtime.ioDevices[t].postData(e)}setVideoProvider(t){this.runtime.ioDevices.video.setProvider(t)}setCloudProvider(t){this.runtime.ioDevices.cloud.setProvider(t)}scanForPeripheral(t){this.runtime.scanForPeripheral(t)}connectPeripheral(t,e){this.runtime.connectPeripheral(t,e)}disconnectPeripheral(t){this.runtime.disconnectPeripheral(t)}getPeripheralIsConnected(t){return this.runtime.getPeripheralIsConnected(t)}loadProject(t){"object"!=typeof t||t instanceof ArrayBuffer||ArrayBuffer.isView(t)||(t=JSON.stringify(t));return new Promise(((e,r)=>{n(80)(t,!1,((t,n)=>{if(t)return r(t);e(n)}))})).catch((e=>{const{SB1File:r,ValidationError:i}=n(294);try{const e=new r(t),n=e.json;return n.projectVersion=2,Promise.resolve([n,e.zip])}catch(t){if(!(t instanceof i||"".concat(t).includes("Non-ascii character in FixedAsciiString")))return Promise.reject(t)}return Promise.reject(e)})).then((t=>this.deserializeProject(t[0],t[1]))).then((()=>this.runtime.handleProjectLoaded())).catch((t=>Object.prototype.hasOwnProperty.call(t,"validationError")?Promise.reject(JSON.stringify(t)):Promise.reject(t)))}downloadProjectId(t){const e=this.runtime.storage;if(!e)return void u.error("No storage module present; cannot load project: ",t);const n=this;e.load(e.AssetType.Project,t).then((e=>e?n.loadProject(e.data):(u.error("Failed to fetch project with id: ".concat(t)),null)))}_saveProjectZip(){const t=this.toJSON(),e=new s;e.file("project.json",t),this._addFileDescsToZip(this.serializeAssets(),e);const n=new Date(1591657163e3);for(const t of Object.values(e.files))t.date=n;const r=[".json",".svg",".wav",".ttf",".otf"];for(const t of Object.values(e.files))r.some((e=>t.name.endsWith(e)))?t.options.compression="DEFLATE":t.options.compression="STORE";return e}saveProjectSb3(t){return this._saveProjectZip().generateAsync({type:t||"blob",mimeType:"application/x.scratch.sb3"})}saveProjectSb3Stream(t){return this._saveProjectZip().generateInternalStream({type:t||"arraybuffer",mimeType:"application/x.scratch.sb3",compression:"DEFLATE"})}saveProjectSb3DontZip(){const t=this.toJSON(),e={"project.json":(new r).encode(t)};for(const t of this.serializeAssets())e[t.fileName]=t.fileContent;return e}get assets(){return[...this.runtime.targets.reduce(((t,e)=>t.concat(e.sprite.sounds.map((t=>t.asset))).concat(e.sprite.costumes.map((t=>t.asset)))),[]),...this.runtime.fontManager.serializeAssets()]}serializeAssets(t){return[...T(this.runtime,t),...w(this.runtime,t),...this.runtime.fontManager.serializeAssets().map((t=>({fileName:"".concat(t.assetId,".").concat(t.dataFormat),fileContent:t.data})))]}_addFileDescsToZip(t,e){for(let n=0;n<t.length;n++){const r=t[n];e.file(r.fileName,r.fileContent)}}exportSprite(t,e){const n=this.toJSON(t),r=new s;return r.file("sprite.json",n),this._addFileDescsToZip(this.serializeAssets(t),r),r.generateAsync({type:"string"==typeof e?e:"blob",mimeType:"application/x.scratch.sprite3",compression:"DEFLATE",compressionOptions:{level:6}})}toJSON(t,e){const r=n(24);return f.stringify(r.serialize(this.runtime,t,e))}fromJSON(t){return u.warn("fromJSON is now just a wrapper around loadProject, please use that function instead."),this.loadProject(t)}deserializeProject(t,e){this.clear(),"undefined"!=typeof performance&&performance.mark("scratch-vm-deserialize-start");const r=this.runtime;return function(){const i=t.projectVersion;if(2===i){return n(82).deserialize(t,r,!1,e)}if(3===i){return n(24).deserialize(t,r,e)}return Promise.reject("Unable to verify Scratch Project version.")}().then((t=>{let{targets:e,extensions:n}=t;if("undefined"!=typeof performance){performance.mark("scratch-vm-deserialize-end");try{performance.measure("scratch-vm-deserialize","scratch-vm-deserialize-start","scratch-vm-deserialize-end")}catch(t){u.error(t)}}return this.installTargets(e,n,!0)}))}async _loadExtensions(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Map;const r=n(257),i=[];for(const n of t)if(this.extensionManager.isExtensionLoaded(n));else if(this.extensionManager.isBuiltinExtension(n))this.extensionManager.loadExtensionIdSync(n);else{const t=e.get(n)||r.get(n);if(!t)throw new Error("Unknown extension: ".concat(n));if(!await this.securityManager.canLoadExtensionFromProject(t))throw new Error("Permission to load extension denied: ".concat(n));i.push(this.extensionManager.loadExtensionURL(t))}return Promise.all(i)}async installTargets(t,e,n){return await this.extensionManager.allAsyncExtensionsLoaded(),t=t.filter((t=>!!t)),this._loadExtensions(e.extensionIDs,e.extensionURLs).then((()=>{t.forEach((t=>{this.runtime.addTarget(t),t.updateAllDrawableProperties(),t.isSprite()&&this.renameSprite(t.id,t.getName())})),this.runtime.executableTargets.sort(((t,e)=>t.layerOrder-e.layerOrder)),t.forEach((t=>{delete t.layerOrder})),n&&t.length>1?this.editingTarget=t[1]:this.editingTarget=t[0],n||this.editingTarget.fixUpVariableReferences(),n&&this.runtime.parseProjectOptions(),this.emitTargetsUpdate(!1),this.emitWorkspaceUpdate(),this.runtime.setEditingTarget(this.editingTarget),this.runtime.ioDevices.cloud.setStage(this.runtime.getTargetForStage())}))}addSprite(t){const e="Sprite Upload Error:";"object"!=typeof t||t instanceof ArrayBuffer||ArrayBuffer.isView(t)||(t=JSON.stringify(t));return new Promise(((e,r)=>{n(80)(t,!0,((t,n)=>{if(t)return r(t);e(n)}))})).then((t=>{const n=t[0].projectVersion;return 2===n?this._addSprite2(t[0],t[1]):3===n?this._addSprite3(t[0],t[1]):Promise.reject("".concat(e," Unable to verify sprite version."))})).then((()=>this.runtime.emitProjectChanged())).catch((t=>Object.prototype.hasOwnProperty.call(t,"validationError")?Promise.reject(JSON.stringify(t)):Promise.reject("".concat(e," ").concat(t))))}_addSprite2(t,e){return n(82).deserialize(t,this.runtime,!0,e).then((t=>{let{targets:e,extensions:n}=t;return this.installTargets(e,n,!1)}))}_addSprite3(t,e){return n(24).deserialize(t,this.runtime,e,!0).then((t=>{let{targets:e,extensions:n}=t;return this.installTargets(e,n,!1)}))}addCostume(t,e,n,r){const i=n?this.runtime.getTargetById(n):this.editingTarget;return i?y(t,e,this.runtime,r).then((()=>{i.addCostume(e),i.setCostume(i.getCostumes().length-1),this.runtime.emitProjectChanged()})):Promise.reject()}addCostumeFromLibrary(t,e){return this.editingTarget?this.addCostume(t,e,this.editingTarget.id,2):Promise.reject()}duplicateCostume(t){const e=this.editingTarget.getCostumes()[t],n=Object.assign({},e),r="".concat(n.assetId,".").concat(n.dataFormat);return y(r,n,this.runtime).then((()=>{this.editingTarget.addCostume(n,t+1),this.editingTarget.setCostume(t+1),this.emitTargetsUpdate()}))}duplicateSound(t){const e=this.editingTarget.getSounds()[t],n=Object.assign({},e);return v(n,this.runtime,this.editingTarget.sprite.soundBank).then((()=>{this.editingTarget.addSound(n,t+1),this.emitTargetsUpdate()}))}renameCostume(t,e){this.editingTarget.renameCostume(t,e),this.emitTargetsUpdate()}deleteCostume(t){const e=this.editingTarget.deleteCostume(t);if(e){const t=this.editingTarget;return this.runtime.emitProjectChanged(),()=>{t.addCostume(e),this.emitTargetsUpdate()}}return null}addSound(t,e){const n=e?this.runtime.getTargetById(e):this.editingTarget;return n?v(t,this.runtime,n.sprite.soundBank).then((()=>{n.addSound(t),this.emitTargetsUpdate()})):Promise.reject(new Error("No target with ID: ".concat(e)))}renameSound(t,e){this.editingTarget.renameSound(t,e),this.emitTargetsUpdate()}getSoundBuffer(t){const e=this.editingTarget.sprite.sounds[t].soundId;return e&&this.runtime&&this.runtime.audioEngine?this.editingTarget.sprite.soundBank.getSoundPlayer(e).buffer:null}updateSoundBuffer(t,e,n){const r=this.editingTarget.sprite.sounds[t];r&&r.broken&&delete r.broken;const i=r?r.soundId:null;if(i&&this.runtime&&this.runtime.audioEngine&&(this.editingTarget.sprite.soundBank.getSoundPlayer(i).buffer=e),n){r.format="";const t=this.runtime.storage;r.asset=t.createAsset(t.AssetType.Sound,t.DataFormat.WAV,n,null,!0),r.assetId=r.asset.assetId,r.dataFormat=t.DataFormat.WAV,r.md5="".concat(r.assetId,".").concat(r.dataFormat),r.sampleCount=e.length,r.rate=e.sampleRate}this.emitTargetsUpdate()}deleteSound(t){const e=this.editingTarget,n=this.editingTarget.deleteSound(t);if(n){this.runtime.emitProjectChanged();return()=>{e.addSound(n),this.emitTargetsUpdate()}}return null}getCostume(t){const e=this.editingTarget.getCostumes()[t].asset;if(!e||!this.runtime||!this.runtime.storage)return null;const n=e.dataFormat;return n===this.runtime.storage.DataFormat.SVG?e.decodeText():n===this.runtime.storage.DataFormat.PNG||n===this.runtime.storage.DataFormat.JPG?e.encodeDataURI():(u.error("Unhandled format: ".concat(e.dataFormat)),null)}getExportedCostume(t){return E(t)}getExportedCostumeBase64(t){const e=this.getExportedCostume(t);return A.uint8ArrayToBase64(e)}updateBitmap(t,e,n,r,i){return this._updateBitmap(this.editingTarget.getCostumes()[t],e,n,r,i)}_updateBitmap(t,e,n,r,i){if(!(t&&this.runtime&&this.runtime.renderer))return;t&&t.broken&&delete t.broken,t.rotationCenterX=n,t.rotationCenterY=r;const s=0===e.sourceWidth?0:e.width,a=0===e.sourceHeight?0:e.height,c=document.createElement("canvas");c.width=s,c.height=a;c.getContext("2d").putImageData(e,0,0),this.runtime.renderer.updateBitmapSkin(t.skinId,c,i,[n/i,r/i]),c.toBlob((e=>{const n=new FileReader;n.addEventListener("loadend",(()=>{const e=this.runtime.storage;t.dataFormat=e.DataFormat.PNG,t.bitmapResolution=i,t.size=[s,a],t.asset=e.createAsset(e.AssetType.ImageBitmap,t.dataFormat,o.from(n.result),null,!0),t.assetId=t.asset.assetId,t.md5="".concat(t.assetId,".").concat(t.dataFormat),this.emitTargetsUpdate()})),e&&n.readAsArrayBuffer(e)}))}updateSvg(t,e,n,r){return this._updateSvg(this.editingTarget.getCostumes()[t],e,n,r)}_updateSvg(t,e,n,i){t&&t.broken&&delete t.broken,t&&this.runtime&&this.runtime.renderer&&(t.rotationCenterX=n,t.rotationCenterY=i,this.runtime.renderer.updateSVGSkin(t.skinId,e,[n,i]),t.size=this.runtime.renderer.getSkinSize(t.skinId));const s=this.runtime.storage;t.dataFormat=s.DataFormat.SVG,t.bitmapResolution=1,t.asset=s.createAsset(s.AssetType.ImageVector,t.dataFormat,(new r).encode(e),null,!0),t.assetId=t.asset.assetId,t.md5="".concat(t.assetId,".").concat(t.dataFormat),this.emitTargetsUpdate()}addBackdrop(t,e){return y(t,e,this.runtime).then((()=>{const t=this.runtime.getTargetForStage();t.addCostume(e),t.setCostume(t.getCostumes().length-1),this.runtime.emitProjectChanged()}))}renameSprite(t,e){const n=this.runtime.getTargetById(t);if(!n)throw new Error("No target with the provided id.");{if(!n.isSprite())throw new Error("Cannot rename non-sprite targets.");const t=n.sprite;if(!t)throw new Error("No sprite associated with this target.");if(e&&-1===k.indexOf(e)){const r=this.runtime.targets.filter((t=>t.isSprite()&&t.id!==n.id)).map((t=>t.sprite.name)),i=t.name,s=f.unusedName(e,r);if(t.name=s,i===s)return;const o=this.runtime.targets;for(let t=0;t<o.length;t++){o[t].blocks.updateAssetName(i,e,"sprite")}s!==i&&this.emitTargetsUpdate()}}}deleteSprite(t){const e=this.runtime.getTargetById(t);if(e){const n=this.runtime.targets.map((t=>t.id)).indexOf(e.id);if(!e.isSprite())throw new Error("Cannot delete non-sprite targets.");const r=e.sprite;if(!r)throw new Error("No sprite associated with this target.");const i=this.exportSprite(t,"uint8array"),s=()=>i.then((t=>this.addSprite(t)));e.deleteMonitors();const o=this.editingTarget;for(let t=0;t<r.clones.length;t++){const e=r.clones[t];if(this.runtime.stopForTarget(r.clones[t]),this.runtime.disposeTarget(r.clones[t]),e===o){const t=Math.min(this.runtime.targets.length-1,n);this.runtime.targets.length>0?this.setEditingTarget(this.runtime.targets[t].id):this.editingTarget=null}}return this.emitTargetsUpdate(),s}throw new Error("No target with the provided id.")}duplicateSprite(t){const e=this.runtime.getTargetById(t);if(!e)throw new Error("No target with the provided id.");if(!e.isSprite())throw new Error("Cannot duplicate non-sprite targets.");if(!e.sprite)throw new Error("No sprite associated with this target.");return e.duplicate().then((t=>{this.runtime.addTarget(t),t.goBehindOther(e),this.setEditingTarget(t.id)}))}attachAudioEngine(t){this.runtime.attachAudioEngine(t)}attachRenderer(t){this.runtime.attachRenderer(t)}get renderer(){return this.runtime&&this.runtime.renderer}attachV2SVGAdapter(){}attachV2BitmapAdapter(t){this.runtime.attachV2BitmapAdapter(t)}attachStorage(t){this.runtime.attachStorage(t)}setLocale(t,e){return t!==m.setup().locale&&m.setup({locale:t,translations:{[t]:e}}),this.emit("LOCALE_CHANGED",t),this.extensionManager.refreshBlocks()}getLocale(){return m.setup().locale}blockListener(t){this.editingTarget&&this.editingTarget.blocks.blocklyListen(t)}flyoutBlockListener(t){this.runtime.flyoutBlocks.blocklyListen(t)}monitorBlockListener(t){-1!==["create","change"].indexOf(t.type)&&this.runtime.monitorBlocks.blocklyListen(t)}variableListener(t){-1!==["var_create","var_rename","var_delete"].indexOf(t.type)&&this.runtime.getTargetForStage().blocks.blocklyListen(t)}clearFlyoutBlocks(){this.runtime.flyoutBlocks.deleteAllBlocks()}setEditingTarget(t){if(this.editingTarget&&t===this.editingTarget.id)return;const e=this.runtime.getTargetById(t);e&&(this.editingTarget=e,this.emitTargetsUpdate(!1),this.emitWorkspaceUpdate(),this.runtime.setEditingTarget(e))}exportStandaloneBlocks(t){return n(24).serializeStandaloneBlocks(t,this.runtime)}shareBlocksToTarget(t,e,r){const i=n(24),{blocks:s,extensionURLs:o}=i.deserializeStandaloneBlocks(t);b(s);const a=this.runtime.getTargetById(e);if(r){this.runtime.getTargetById(r).resolveVariableSharingConflictsWithTarget(s,a)}const c=new Set(s.map((t=>i.getExtensionIdForOpcode(t.opcode))).filter((t=>!!t)).filter((t=>!this.extensionManager.isExtensionLoaded(t))));return this._loadExtensions(c,o).then((()=>{s.forEach((t=>{a.blocks.createBlock(t)})),a.blocks.updateTargetSpecificBlocks(a.isStage)}))}shareCostumeToTarget(t,e){const n=this.editingTarget.getCostumes()[t],r=Object.assign({},n),i="".concat(r.assetId,".").concat(r.dataFormat);return y(i,r,this.runtime).then((()=>{const t=this.runtime.getTargetById(e);t&&(t.addCostume(r),t.setCostume(t.getCostumes().length-1))}))}shareSoundToTarget(t,e){const n=this.editingTarget.getSounds()[t],r=Object.assign({},n),i=this.runtime.getTargetById(e);return v(r,this.runtime,i.sprite.soundBank).then((()=>{i&&(i.addSound(r),this.emitTargetsUpdate())}))}refreshWorkspace(){this.editingTarget&&(this.emitWorkspaceUpdate(),this.runtime.setEditingTarget(this.editingTarget),this.emitTargetsUpdate(!1))}emitTargetsUpdate(t){let e;void 0===t&&(t=!0);const n=()=>(e||(e=this.runtime.targets.filter((t=>!Object.prototype.hasOwnProperty.call(t,"isOriginal")||t.isOriginal)).map((t=>t.toJSON()))),e);this.emit("targetsUpdate",{get targetList(){return n()},editingTarget:this.editingTarget?this.editingTarget.id:null}),t&&this.runtime.emitProjectChanged()}emitWorkspaceUpdate(){const t=this.runtime.getTargetForStage().variables;let e=[];for(const n in t)t[n].type===g.BROADCAST_MESSAGE_TYPE&&e.push(n);for(let t=0;t<this.runtime.targets.length;t++){const n=this.runtime.targets[t].blocks._blocks;for(const t in n)if(n[t].fields.BROADCAST_OPTION){const r=n[t].fields.BROADCAST_OPTION.id,i=e.indexOf(r);-1!==i&&(e=e.slice(0,i).concat(e.slice(i+1)))}}for(let t=0;t<e.length;t++){const n=e[t];delete this.runtime.getTargetForStage().variables[n]}const n=Object.assign({},this.runtime.getTargetForStage().variables),r=this.editingTarget.isStage?Object.create(null):Object.assign({},this.editingTarget.variables),i=Object.keys(n).map((t=>n[t])),s=Object.keys(r).map((t=>r[t])),o=Object.keys(this.editingTarget.comments).map((t=>this.editingTarget.comments[t])).filter((t=>null===t.blockId)),a='<xml xmlns="http://www.w3.org/1999/xhtml">\n                            <variables>\n                                '.concat(i.map((t=>t.toXML())).join(),"\n                                ").concat(s.map((t=>t.toXML(!0))).join(),"\n                            </variables>\n                            ").concat(o.map((t=>t.toXML())).join(),"\n                            ").concat(this.editingTarget.blocks.toXML(this.editingTarget.comments),"\n                        </xml>");this.emit("workspaceUpdate",{xml:a})}getTargetIdForDrawableId(t){const e=this.runtime.getTargetByDrawableId(t);return e&&Object.prototype.hasOwnProperty.call(e,"id")&&Object.prototype.hasOwnProperty.call(e,"isStage")&&!e.isStage?e.id:null}reorderTarget(t,e){let n=this.runtime.targets;if((t=l.clamp(t,0,n.length-1))===(e=l.clamp(e,0,n.length-1)))return!1;const r=n[t];return n=n.slice(0,t).concat(n.slice(t+1)),n.splice(e,0,r),this.runtime.targets=n,this.emitTargetsUpdate(),!0}reorderCostume(t,e,n){const r=this.runtime.getTargetById(t);if(r){const t=r.reorderCostume(e,n);return t&&this.runtime.emitProjectChanged(),t}return!1}reorderSound(t,e,n){const r=this.runtime.getTargetById(t);if(r){const t=r.reorderSound(e,n);return t&&this.runtime.emitProjectChanged(),t}return!1}startDrag(t){const e=this.runtime.getTargetById(t);e&&(this._dragTarget=e,e.startDrag())}stopDrag(t){const e=this.runtime.getTargetById(t);e&&(this._dragTarget=null,e.stopDrag(),this.setEditingTarget(e.sprite&&e.sprite.clones[0]?e.sprite.clones[0].id:e.id))}postSpriteInfo(t){this._dragTarget?this._dragTarget.postSpriteInfo(t):this.editingTarget.postSpriteInfo(t),this.runtime.emitProjectChanged()}setVariableValue(t,e,n){const r=this.runtime.getTargetById(t);if(r){const t=r.lookupVariableById(e);if(t)return t.value=n,t.isCloud&&this.runtime.ioDevices.cloud.requestUpdateVariable(t.name,t.value),!0}return!1}getVariableValue(t,e){const n=this.runtime.getTargetById(t);if(n){const t=n.lookupVariableById(e);if(t)return t.value}return null}configureScratchLinkSocketFactory(t){this.runtime.configureScratchLinkSocketFactory(t)}}},function(t,e,n){"use strict";(function(t){!function(t){function e(){}function n(){}var r=String.fromCharCode,i={}.toString,s=i.call(t.SharedArrayBuffer),o=i(),a=t.Uint8Array,c=a||Array,u=a?ArrayBuffer:c,l=u.isView||function(t){return t&&"length"in t},h=i.call(u.prototype);u=n.prototype;var d=t.TextEncoder,p=new(a?Uint16Array:c)(32);e.prototype.decode=function(t){if(!l(t)){var e=i.call(t);if(e!==h&&e!==s&&e!==o)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");t=a?new c(t):t||[]}for(var n,u,d,f=e="",m=0,g=0|t.length,b=g-32|0,y=0,v=0,w=0,T=-1;m<g;){for(n=m<=b?32:g-m|0;w<n;m=m+1|0,w=w+1|0){switch((u=255&t[m])>>4){case 15:if(2!=(d=255&t[m=m+1|0])>>6||247<u){m=m-1|0;break}y=(7&u)<<6|63&d,v=5,u=256;case 14:y<<=6,y|=(15&u)<<6|63&(d=255&t[m=m+1|0]),v=2==d>>6?v+4|0:24,u=u+256&768;case 13:case 12:y<<=6,y|=(31&u)<<6|63&(d=255&t[m=m+1|0]),v=v+7|0,m<g&&2==d>>6&&y>>v&&1114112>y?(u=y,0<=(y=y-65536|0)&&(T=55296+(y>>10)|0,u=56320+(1023&y)|0,31>w?(p[w]=T,w=w+1|0,T=-1):(d=T,T=u,u=d))):(m=m-(u>>=8)-1|0,u=65533),y=v=0,n=m<=b?32:g-m|0;default:p[w]=u;continue;case 11:case 10:case 9:case 8:}p[w]=65533}if(f+=r(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15],p[16],p[17],p[18],p[19],p[20],p[21],p[22],p[23],p[24],p[25],p[26],p[27],p[28],p[29],p[30],p[31]),32>w&&(f=f.slice(0,w-32|0)),m<g){if(p[0]=T,w=~T>>>31,T=-1,f.length<e.length)continue}else-1!==T&&(f+=r(T));e+=f,f=""}return e},u.encode=function(t){var e,n=0|(t=void 0===t?"":""+t).length,r=new c(8+(n<<1)|0),i=0,s=!a;for(e=0;e<n;e=e+1|0,i=i+1|0){var o=0|t.charCodeAt(e);if(127>=o)r[i]=o;else{if(2047>=o)r[i]=192|o>>6;else{t:{if(55296<=o)if(56319>=o){var u=0|t.charCodeAt(e=e+1|0);if(56320<=u&&57343>=u){if(65535<(o=(o<<10)+u-56613888|0)){r[i]=240|o>>18,r[i=i+1|0]=128|o>>12&63,r[i=i+1|0]=128|o>>6&63,r[i=i+1|0]=128|63&o;continue}break t}o=65533}else 57343>=o&&(o=65533);!s&&e<<1<i&&e<<1<(i-7|0)&&(s=!0,(u=new c(3*n)).set(r),r=u)}r[i]=224|o>>12,r[i=i+1|0]=128|o>>6&63}r[i=i+1|0]=128|63&o}}return a?r.subarray(0,i):r.slice(0,i)},d||(t.TextDecoder=e,t.TextEncoder=n)}(""+void 0==typeof t?""+void 0==typeof self?this:self:t)}).call(this,n(8))},function(t,e,n){const r=n(0);t.exports=class{constructor(){this.callbacks=[],this.nextResponseId=0}call(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return this.transferCall(t,e,null,...r)}transferCall(t,e,n){try{const{provider:o,isRemote:a}=this._getServiceProvider(t);if(o){for(var r=arguments.length,i=new Array(r>3?r-3:0),s=3;s<r;s++)i[s-3]=arguments[s];if(a)return this._remoteTransferCall(o,t,e,n,...i);const c=o[e].apply(o,i);return Promise.resolve(c)}return Promise.reject(new Error("Service not found: ".concat(t)))}catch(t){return Promise.reject(t)}}_isRemoteService(t){return this._getServiceProvider(t).isRemote}_remoteCall(t,e,n){for(var r=arguments.length,i=new Array(r>3?r-3:0),s=3;s<r;s++)i[s-3]=arguments[s];return this._remoteTransferCall(t,e,n,null,...i)}_remoteTransferCall(t,e,n,r){for(var i=arguments.length,s=new Array(i>4?i-4:0),o=4;o<i;o++)s[o-4]=arguments[o];return new Promise(((i,o)=>{const a=this._storeCallbacks(i,o);s.length>0&&"function"==typeof s[s.length-1].func&&(s.pop(),s.pop()),r?t.postMessage({service:e,method:n,responseId:a,args:s},r):t.postMessage({service:e,method:n,responseId:a,args:s})}))}_storeCallbacks(t,e){const n=this.nextResponseId++;return this.callbacks[n]=[t,e],n}_deliverResponse(t,e){try{const[n,r]=this.callbacks[t];delete this.callbacks[t],e.error?r(e.error):n(e.result)}catch(t){r.error("Dispatch callback failed: ".concat(t))}}_onMessage(t,e){const n=e.data;let i;n.args=n.args||[],n.service?i="dispatch"===n.service?this._onDispatchMessage(t,n):this.call(n.service,n.method,...n.args):void 0===n.responseId?r.error("Dispatch caught malformed message from a worker: ".concat(JSON.stringify(e))):this._deliverResponse(n.responseId,n),i&&(void 0===n.responseId?r.error("Dispatch message missing required response ID: ".concat(JSON.stringify(e))):i.then((e=>t.postMessage({responseId:n.responseId,result:e})),(e=>t.postMessage({responseId:n.responseId,error:"".concat(e)}))))}_getServiceProvider(t){throw new Error("Could not get provider for ".concat(t,": _getServiceProvider not implemented"))}_onDispatchMessage(t,e){throw new Error("Unimplemented dispatch message handler cannot handle ".concat(e.method," method"))}}},function(t,e,n){const r=n(53),i=n(0),s=n(54),o=n(2),a=n(108),c={coreExample:()=>n(109),pen:()=>n(110),wedo2:()=>n(111),music:()=>n(115),microbit:()=>n(178),text2speech:()=>n(179),translate:()=>n(180),videoSensing:()=>n(181),ev3:()=>n(214),makeymakey:()=>n(216),boost:()=>n(217),gdxfor:()=>n(218),tw:()=>n(221)};t.exports=class{constructor(t){this.nextExtensionWorker=0,this.pendingExtensions=[],this.pendingWorkers=[],this.workerURLs=[],this._loadedExtensions=new Map,this.securityManager=new a,this.vm=t,this.runtime=t.runtime,this.loadingAsyncExtensions=0,this.asyncExtensionsLoadedCallbacks=[],this.builtinExtensions=Object.assign({},c),r.setService("extensions",(t=>{const e={};return e.registerExtensionServiceSync=t.registerExtensionServiceSync.bind(t),e.allocateWorker=t.allocateWorker.bind(t),e.onWorkerInit=t.onWorkerInit.bind(t),e.registerExtensionService=t.registerExtensionService.bind(t),e})(this)).catch((t=>{i.error("ExtensionManager was unable to register extension service: ".concat(JSON.stringify(t)))}))}isExtensionLoaded(t){return this._loadedExtensions.has(t)}isBuiltinExtension(t){return Object.prototype.hasOwnProperty.call(this.builtinExtensions,t)}loadExtensionIdSync(t){if(!this.isBuiltinExtension(t))return void i.warn("Could not find extension ".concat(t," in the built in extensions."));if(this.isExtensionLoaded(t)){const e="Rejecting attempt to load a second extension with ID ".concat(t);return void i.warn(e)}const e=new(this.builtinExtensions[t]())(this.runtime),n=this._registerInternalExtension(e);this._loadedExtensions.set(t,n),this.runtime.compilerRegisterExtension(t,e)}addBuiltinExtension(t,e){this.builtinExtensions[t]=()=>e}_isValidExtensionURL(t){try{const e=new URL(t);return"https:"===e.protocol||"http:"===e.protocol||"data:"===e.protocol||"file:"===e.protocol}catch(t){return!1}}async loadExtensionURL(t){if(this.isBuiltinExtension(t))return void this.loadExtensionIdSync(t);if(this.isExtensionURLLoaded(t))return;if(!this._isValidExtensionURL(t))throw new Error("Invalid extension URL: ".concat(t));this.runtime.setExternalCommunicationMethod("customExtensions",!0),this.loadingAsyncExtensions++;const e=await this.securityManager.getSandboxMode(t),i=await this.securityManager.rewriteExtensionURL(t);if("unsandboxed"===e){const{load:e}=n(222),s=await e(i,this.vm).catch((t=>this._failedLoadingExtensionScript(t))),o=this.nextExtensionWorker++;this.workerURLs[o]=t;for(const t of s){const e=t.getInfo(),n="unsandboxed.".concat(o,".").concat(e.id);r.setServiceSync(n,t),r.callSync("extensions","registerExtensionServiceSync",n),this._loadedExtensions.set(e.id,n)}return void this._finishedLoadingExtensionScript()}let s;if("worker"===e)s=n(228);else{if("iframe"!==e)throw new Error("Invalid sandbox mode: ".concat(e));s=(await n.e(1).then(n.t.bind(null,297,7))).default}return new Promise(((t,e)=>{this.pendingExtensions.push({extensionURL:i,resolve:t,reject:e}),r.addWorker(new s)})).catch((t=>this._failedLoadingExtensionScript(t)))}allAsyncExtensionsLoaded(){if(0!==this.loadingAsyncExtensions)return new Promise(((t,e)=>{this.asyncExtensionsLoadedCallbacks.push({resolve:t,reject:e})}))}refreshBlocks(t){const e=t=>r.call(t,"getInfo").then((e=>{e=this._prepareExtensionInfo(t,e),r.call("runtime","_refreshExtensionPrimitives",e)})).catch((t=>{i.error("Failed to refresh built-in extension primitives",t)}));if(t)return this._loadedExtensions.has(t)?e(this._loadedExtensions.get(t)):Promise.reject(new Error("Unknown extension: ".concat(t)));const n=Array.from(this._loadedExtensions.values()).map(e);return Promise.all(n)}allocateWorker(){const t=this.nextExtensionWorker++,e=this.pendingExtensions.shift();return this.pendingWorkers[t]=e,this.workerURLs[t]=e.extensionURL,[t,e.extensionURL]}registerExtensionServiceSync(t){const e=r.callSync(t,"getInfo");this._registerExtensionInfo(t,e)}registerExtensionService(t){r.call(t,"getInfo").then((e=>{this._loadedExtensions.set(e.id,t),this._registerExtensionInfo(t,e),this._finishedLoadingExtensionScript()}))}_finishedLoadingExtensionScript(){this.loadingAsyncExtensions--,0===this.loadingAsyncExtensions&&(this.asyncExtensionsLoadedCallbacks.forEach((t=>t.resolve())),this.asyncExtensionsLoadedCallbacks=[])}_failedLoadingExtensionScript(t){throw this.loadingAsyncExtensions--,this.asyncExtensionsLoadedCallbacks.forEach((e=>e.reject(t))),this.asyncExtensionsLoadedCallbacks=[],t}onWorkerInit(t,e){const n=this.pendingWorkers[t];delete this.pendingWorkers[t],e?n.reject(e):n.resolve()}_registerInternalExtension(t){const e=t.getInfo(),n=this.nextExtensionWorker++,i="extension_".concat(n,"_").concat(e.id);return r.setServiceSync(i,t),r.callSync("extensions","registerExtensionServiceSync",i),i}_registerExtensionInfo(t,e){e=this._prepareExtensionInfo(t,e),r.call("runtime","_registerExtensionPrimitives",e).catch((e=>{i.error("Failed to register primitives for extension on service ".concat(t,":"),e)}))}_prepareExtensionInfo(t,e){if(e=Object.assign({},e),!/^[a-z0-9]+$/i.test(e.id))throw new Error("Invalid extension id");return e.name=e.name||e.id,e.blocks=e.blocks||[],e.targetTypes=e.targetTypes||[],e.blocks=e.blocks.reduce(((e,n)=>{try{let r;if("---"===n)r="---";else r=this._prepareBlockInfo(t,n);e.push(r)}catch(t){i.error("Error processing block: ".concat(t.message,", Block:\n").concat(JSON.stringify(n)))}return e}),[]),e.menus=e.menus||{},e.menus=this._prepareMenuInfo(t,e.menus),e}_prepareMenuInfo(t,e){const n=Object.getOwnPropertyNames(e);for(let i=0;i<n.length;i++){const s=n[i];let o=e[s];if(o.items||(o={items:o},e[s]=o),"string"==typeof o.items){const e=o.items,n=r.services[t];o.items=this._getExtensionMenuItems.bind(this,n,e)}}return e}_getExtensionMenuItems(t,e){const n=this.runtime.getEditingTarget()||this.runtime.getTargetForStage(),r=n?n.id:null,i=this.runtime.makeMessageContextForTarget(n),o=t[e].call(t,r).map((t=>{switch(typeof(t=s(t,i))){case"object":return[s(t.text,i),t.value];case"string":return[t,t];default:return t}}));if(!o||o.length<1)throw new Error("Extension menu returned no items: ".concat(e));return o}_prepareBlockInfo(t,e){if(e.blockType===o.XML)return(e=Object.assign({},e)).xml=String(e.xml)||"",e;switch((e=Object.assign({},{blockType:o.COMMAND,terminal:!1,blockAllThreads:!1,arguments:{}},e)).text=e.text||e.opcode,e.blockType){case o.EVENT:e.func&&i.warn('Ignoring function "'.concat(e.func,'" for event block ').concat(e.opcode));break;case o.BUTTON:e.opcode&&i.warn('Ignoring opcode "'.concat(e.opcode,'" for button with text: ').concat(e.text)),e.callFunc=()=>{r.call(t,e.func)};break;case o.LABEL:e.opcode&&i.warn('Ignoring opcode "'.concat(e.opcode,'" for label: ').concat(e.text));break;default:{if(!e.opcode)throw new Error("Missing opcode for block");const n=e.func||e.opcode,s=e.isDynamic?t=>t&&t.mutation&&t.mutation.blockInfo:()=>e,o=(()=>{if(r._isRemoteService(t))return(e,i,s)=>r.call(t,n,e,i,s).then((t=>"number"==typeof t||"string"==typeof t||"boolean"==typeof t?t:"".concat(t)));const e=r.services[t];return e[n]||i.warn("Could not find extension block function called ".concat(n)),(t,r,i)=>e[n](t,r,i)})();e.func=(t,e)=>{const n=s(t);return o(t,e,n)};break}}return e}getExtensionURLs(){const t={};for(const[e,n]of this._loadedExtensions.entries()){if(Object.prototype.hasOwnProperty.call(this.builtinExtensions,e))continue;const r=+n.split(".")[1],i=this.workerURLs[r];"string"==typeof i&&(t[e]=i)}return t}isExtensionURLLoaded(t){return Object.values(this.workerURLs).includes(t)}}},function(t,e,n){"use strict";var r="{",i="}",s=",",o="#",a="<",c=">",u="</",l="/>",h="'",d="offset:",p=["number","date","time","ordinal","duration","spellout"],f=["plural","select","selectordinal"];function m(t,e){var n=t.pattern,r=n.length,s=[],o=t.index,a=g(t,e);for(a&&s.push(a),a&&t.tokens&&t.tokens.push(["text",n.slice(o,t.index)]);t.index<r;){if(n[t.index]===i){if(!e)throw I(t);break}if(e&&t.tagsType&&n.slice(t.index,t.index+2)===u)break;s.push(v(t)),o=t.index,(a=g(t,e))&&s.push(a),a&&t.tokens&&t.tokens.push(["text",n.slice(o,t.index)])}return s}function g(t,e){for(var n=t.pattern,s=n.length,c="plural"===e||"selectordinal"===e,u=!!t.tagsType,l="{style}"===e,d="";t.index<s;){var p=n[t.index];if(p===r||p===i||c&&p===o||u&&p===a||l&&b(p.charCodeAt(0)))break;if(p===h)if((p=n[++t.index])===h)d+=p,++t.index;else if(p===r||p===i||c&&p===o||u&&p===a||l)for(d+=p;++t.index<s;)if((p=n[t.index])===h&&n[t.index+1]===h)d+=h,++t.index;else{if(p===h){++t.index;break}d+=p}else d+=h;else d+=p,++t.index}return d}function b(t){return t>=9&&t<=13||32===t||133===t||160===t||6158===t||t>=8192&&t<=8205||8232===t||8233===t||8239===t||8287===t||8288===t||12288===t||65279===t}function y(t){for(var e=t.pattern,n=e.length,r=t.index;t.index<n&&b(e.charCodeAt(t.index));)++t.index;r<t.index&&t.tokens&&t.tokens.push(["space",t.pattern.slice(r,t.index)])}function v(t){var e=t.pattern;if(e[t.index]===o)return t.tokens&&t.tokens.push(["syntax",o]),++t.index,[o];var n=function(t){var e=t.tagsType;if(!e||t.pattern[t.index]!==a)return;if(t.pattern.slice(t.index,t.index+2)===u)throw I(t,null,"closing tag without matching opening tag");t.tokens&&t.tokens.push(["syntax",a]);++t.index;var n=w(t,!0);if(!n)throw I(t,"placeholder id");t.tokens&&t.tokens.push(["id",n]);if(y(t),t.pattern.slice(t.index,t.index+2)===l)return t.tokens&&t.tokens.push(["syntax",l]),t.index+=2,[n,e];if(t.pattern[t.index]!==c)throw I(t,c);t.tokens&&t.tokens.push(["syntax",c]);++t.index;var r=m(t,e),i=t.index;if(t.pattern.slice(t.index,t.index+2)!==u)throw I(t,u+n+c);t.tokens&&t.tokens.push(["syntax",u]);t.index+=2;var s=w(t,!0);s&&t.tokens&&t.tokens.push(["id",s]);if(n!==s)throw t.index=i,I(t,u+n+c,u+s+c);if(y(t),t.pattern[t.index]!==c)throw I(t,c);t.tokens&&t.tokens.push(["syntax",c]);return++t.index,[n,e,{children:r}]}(t);if(n)return n;if(e[t.index]!==r)throw I(t,r);t.tokens&&t.tokens.push(["syntax",r]),++t.index,y(t);var h=w(t);if(!h)throw I(t,"placeholder id");t.tokens&&t.tokens.push(["id",h]),y(t);var f=e[t.index];if(f===i)return t.tokens&&t.tokens.push(["syntax",i]),++t.index,[h];if(f!==s)throw I(t,", or }");t.tokens&&t.tokens.push(["syntax",s]),++t.index,y(t);var g,b=w(t);if(!b)throw I(t,"placeholder type");if(t.tokens&&t.tokens.push(["type",b]),y(t),(f=e[t.index])===i){if(t.tokens&&t.tokens.push(["syntax",i]),"plural"===b||"selectordinal"===b||"select"===b)throw I(t,b+" sub-messages");return++t.index,[h,b]}if(f!==s)throw I(t,", or }");if(t.tokens&&t.tokens.push(["syntax",s]),++t.index,y(t),"plural"===b||"selectordinal"===b){var v=function(t){var e=t.pattern,n=e.length,r=0;if(e.slice(t.index,t.index+7)===d){t.tokens&&t.tokens.push(["offset","offset"],["syntax",":"]),t.index+=7,y(t);for(var i=t.index;t.index<n&&E(e.charCodeAt(t.index));)++t.index;if(i===t.index)throw I(t,"offset number");t.tokens&&t.tokens.push(["number",e.slice(i,t.index)]),r=+e.slice(i,t.index)}return r}(t);y(t),g=[h,b,v,A(t,b)]}else if("select"===b)g=[h,b,A(t,b)];else if(p.indexOf(b)>=0)g=[h,b,T(t)];else{var k=t.index,S=T(t);y(t),e[t.index]===r&&(t.index=k,S=A(t,b)),g=[h,b,S]}if(y(t),e[t.index]!==i)throw I(t,i);return t.tokens&&t.tokens.push(["syntax",i]),++t.index,g}function w(t,e){for(var n=t.pattern,u=n.length,l="";t.index<u;){var d=n[t.index];if(d===r||d===i||d===s||d===o||d===h||b(d.charCodeAt(0))||e&&(d===a||d===c||"/"===d))break;l+=d,++t.index}return l}function T(t){var e=t.index,n=g(t,"{style}");if(!n)throw I(t,"placeholder style name");return t.tokens&&t.tokens.push(["style",t.pattern.slice(e,t.index)]),n}function E(t){return t>=48&&t<=57}function A(t,e){for(var n=t.pattern,r=n.length,s={};t.index<r&&n[t.index]!==i;){var o=w(t);if(!o)throw I(t,"sub-message selector");t.tokens&&t.tokens.push(["selector",o]),y(t),s[o]=k(t,e),y(t)}if(!s.other&&f.indexOf(e)>=0)throw I(t,null,null,'"other" sub-message must be specified in '+e);return s}function k(t,e){if(t.pattern[t.index]!==r)throw I(t,"{ to start sub-message");t.tokens&&t.tokens.push(["syntax",r]),++t.index;var n=m(t,e);if(t.pattern[t.index]!==i)throw I(t,"} to end sub-message");return t.tokens&&t.tokens.push(["syntax",i]),++t.index,n}function I(t,e,n,r){var i=t.pattern,s=i.slice(0,t.index).split(/\r?\n/),o=t.index,a=s.length,c=s.slice(-1)[0].length;return n=n||(t.index>=i.length?"end of message pattern":w(t)||i[t.index]),r||(r=function(t,e){return t?"Expected "+t+" but found "+e:"Unexpected "+e+" found"}(e,n)),new S(r+=" in "+i.replace(/\r?\n/g,"\n"),e,n,o,a,c)}function S(t,e,n,r,i,s){Error.call(this,t),this.name="SyntaxError",this.message=t,this.expected=e,this.found=n,this.offset=r,this.line=i,this.column=s}e=t.exports=function(t,e){return m({pattern:String(t),index:0,tagsType:e&&e.tagsType||null,tokens:e&&e.tokens||null},"")},S.prototype=Object.create(Error.prototype),e.SyntaxError=S},function(t,e,n){"use strict";var r=n(55),i=n(56),s=n(57);function o(t,e,n,r,i){var s=t.map((function(t){return function(t,e,n,r,i){if("string"==typeof t){var s=t;return function(){return s}}var c,u=t[0],l=t[1];if(e&&"#"===t[0]){u=e[0];var h=e[2],p=(r.number||d.number)([u,"number"],n);return function(t){return p(a(u,t)-h,t)}}"plural"===l||"selectordinal"===l?(c={},Object.keys(t[3]).forEach((function(e){c[e]=o(t[3][e],t,n,r,i)})),t=[t[0],t[1],t[2],c]):t[2]&&"object"==typeof t[2]&&(c={},Object.keys(t[2]).forEach((function(e){c[e]=o(t[2][e],t,n,r,i)})),t=[t[0],t[1],c]);var f=l&&(r[l]||d[l]);if(f){var m=f(t,n);return function(t){return m(a(u,t),t)}}return i?function(t){return String(a(u,t))}:function(t){return a(u,t)}}(t,e,n,r,i)}));return i?1===s.length?s[0]:function(t){for(var e="",n=0;n<s.length;++n)e+=s[n](t);return e}:function(t){return s.reduce((function(e,n){return e.concat(n(t))}),[])}}function a(t,e){if(e&&t in e)return e[t];for(var n=t.split("."),r=e,i=0,s=n.length;r&&i<s;++i)r=r[n[i]];return r}function c(t,e){var n=t[2],i=r.number[n]||r.parseNumberPattern(n)||r.number.default;return new Intl.NumberFormat(e,i).format}function u(t,e){var n=t[1],i=t[2],s=r[n][i]||r.parseDatePattern(i)||r[n].default;return new Intl.DateTimeFormat(e,s).format}function l(t,e){var n,r="selectordinal"===t[1]?"ordinal":"cardinal",o=t[2],a=t[3];if(Intl.PluralRules&&Intl.PluralRules.supportedLocalesOf(e).length>0)n=new Intl.PluralRules(e,{type:r});else{var c=i(e,s),u=c&&s[c][r]||h;n={select:u}}return function(t,e){return(a["="+ +t]||a[n.select(t-o)]||a.other)(e)}}function h(){return"other"}(e=t.exports=function(t,e,n){return o(t,null,e||"en",n||{},!0)}).toParts=function(t,e,n){return o(t,null,e||"en",n||{},!1)};var d={number:c,ordinal:c,spellout:c,duration:function(t,e){var n=t[2],i=r.duration[n]||r.duration.default,s=new Intl.NumberFormat(e,i.seconds).format,o=new Intl.NumberFormat(e,i.minutes).format,a=new Intl.NumberFormat(e,i.hours).format,c=/^fi$|^fi-|^da/.test(String(e))?".":":";return function(t,e){if(t=+t,!isFinite(t))return s(t);var n=~~(t/60/60),r=~~(t/60%60),i=(n?a(Math.abs(n))+c:"")+o(Math.abs(r))+c+s(Math.abs(t%60));return t<0?a(-1).replace(a(1),i):i}},date:u,time:u,plural:l,selectordinal:l,select:function(t,e){var n=t[2];return function(t,e){return(n[t]||n.other)(e)}}};e.types=d},function(t,e){t.exports=class{getSandboxMode(t){return Promise.resolve("worker")}canLoadExtensionFromProject(t){return Promise.resolve(!1)}rewriteExtensionURL(t){return Promise.resolve(t)}canFetch(t){return Promise.resolve(!0)}canOpenWindow(t){return Promise.resolve(!0)}canRedirect(t){return Promise.resolve(!0)}canRecordAudio(){return Promise.resolve(!0)}canRecordVideo(){return Promise.resolve(!0)}canReadClipboard(){return Promise.resolve(!0)}canNotify(){return Promise.resolve(!0)}canGeolocate(){return Promise.resolve(!0)}canEmbed(t){return Promise.resolve(!0)}canDownload(t,e){return Promise.resolve(!0)}}},function(t,e,n){const r=n(2),i=n(3);t.exports=class{constructor(t){this.runtime=t}getInfo(){return{id:"coreExample",name:"CoreEx",blocks:[{func:"MAKE_A_VARIABLE",blockType:r.BUTTON,text:"make a variable (CoreEx)"},{opcode:"exampleOpcode",blockType:r.REPORTER,text:"example block"},{opcode:"exampleWithInlineImage",blockType:r.COMMAND,text:"block with image [CLOCKWISE] inline",arguments:{CLOCKWISE:{type:i.IMAGE,dataURI:'data:image/svg+xml,%3Csvg id="rotate-counter-clockwise" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%233d79cc;%7D.cls-2%7Bfill:%23fff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3Erotate-counter-clockwise%3C/title%3E%3Cpath class="cls-1" d="M22.68,12.2a1.6,1.6,0,0,1-1.27.63H13.72a1.59,1.59,0,0,1-1.16-2.58l1.12-1.41a4.82,4.82,0,0,0-3.14-.77,4.31,4.31,0,0,0-2,.8,4.25,4.25,0,0,0-1.34,1.73,5.06,5.06,0,0,0,.54,4.62A5.58,5.58,0,0,0,12,17.74h0a2.26,2.26,0,0,1-.16,4.52A10.25,10.25,0,0,1,3.74,18,10.14,10.14,0,0,1,2.25,8.78,9.7,9.7,0,0,1,5.08,4.64,9.92,9.92,0,0,1,9.66,2.5a10.66,10.66,0,0,1,7.72,1.68l1.08-1.35a1.57,1.57,0,0,1,1.24-.6,1.6,1.6,0,0,1,1.54,1.21l1.7,7.37A1.57,1.57,0,0,1,22.68,12.2Z"/%3E%3Cpath class="cls-2" d="M21.38,11.83H13.77a.59.59,0,0,1-.43-1l1.75-2.19a5.9,5.9,0,0,0-4.7-1.58,5.07,5.07,0,0,0-4.11,3.17A6,6,0,0,0,7,15.77a6.51,6.51,0,0,0,5,2.92,1.31,1.31,0,0,1-.08,2.62,9.3,9.3,0,0,1-7.35-3.82A9.16,9.16,0,0,1,3.17,9.12,8.51,8.51,0,0,1,5.71,5.4,8.76,8.76,0,0,1,9.82,3.48a9.71,9.71,0,0,1,7.75,2.07l1.67-2.1a.59.59,0,0,1,1,.21L22,11.08A.59.59,0,0,1,21.38,11.83Z"/%3E%3C/svg%3E'}}}]}}exampleOpcode(){const t=this.runtime.getTargetForStage();return t?t.getName():"no stage yet"}exampleWithInlineImage(){}}},function(t,e,n){const r=n(3),i=n(2),s=n(36),o=n(1),a=n(11),c=n(20),u=n(5),l=n(4),h=n(0),d=n(12),p="color",f="saturation",m="brightness",g="transparency";class b{constructor(t){this.runtime=t,this._penDrawableId=-1,this._penSkinId=-1,this._onTargetCreated=this._onTargetCreated.bind(this),this._onTargetMoved=this._onTargetMoved.bind(this),t.on("targetWasCreated",this._onTargetCreated),t.on("RUNTIME_DISPOSED",this.clear.bind(this))}static get DEFAULT_PEN_STATE(){return{penDown:!1,color:66.66,saturation:100,brightness:100,transparency:0,_shade:50,penAttributes:{color4f:[0,0,1,1],diameter:1}}}static get PEN_SIZE_RANGE(){return{min:1,max:1200}}static get STATE_KEY(){return"Scratch.pen"}_clampPenSize(t){return this.runtime.renderer&&this.runtime.renderer.useHighQualityRender||!this.runtime.runtimeOptions.miscLimits?Math.max(0,t):l.clamp(t,b.PEN_SIZE_RANGE.min,b.PEN_SIZE_RANGE.max)}_getPenLayerID(){const t=this.runtime.renderer;return this._penSkinId<0&&t&&(this._penSkinId=t.createPenSkin(),this._penDrawableId=t.createDrawable(d.PEN_LAYER),t.markDrawableAsNoninteractive&&t.markDrawableAsNoninteractive(this._penDrawableId),t.updateDrawableSkinId(this._penDrawableId,this._penSkinId)),this._penSkinId}_getPenState(t){let e=t._customState["Scratch.pen"];return e||(e=a.simple(b.DEFAULT_PEN_STATE),t.setCustomState(b.STATE_KEY,e)),e}_onTargetCreated(t,e){if(e){const n=e.getCustomState(b.STATE_KEY);n&&(t.setCustomState(b.STATE_KEY,a.simple(n)),n.penDown&&(t.onTargetMoved=this._onTargetMoved))}}_onTargetMoved(t,e,n,r){if(!r){const r=this._getPenLayerID();if(r>=0){const i=this._getPenState(t);this.runtime.renderer.penLine(r,i.penAttributes,e,n,t.x,t.y),this.runtime.requestRedraw()}}}_wrapColor(t){return l.wrapClamp(t,0,100)}_initColorParam(){return[{text:u({id:"pen.colorMenu.color",default:"color",description:"label for color element in color picker for pen extension"}),value:p},{text:u({id:"pen.colorMenu.saturation",default:"saturation",description:"label for saturation element in color picker for pen extension"}),value:f},{text:u({id:"pen.colorMenu.brightness",default:"brightness",description:"label for brightness element in color picker for pen extension"}),value:m},{text:u({id:"pen.colorMenu.transparency",default:"transparency",description:"label for transparency element in color picker for pen extension"}),value:g}]}_clampColorParam(t){return l.clamp(t,0,100)}_alphaToTransparency(t){return 100*(1-t)}_transparencyToAlpha(t){return 1-t/100}getInfo(){return{id:"pen",name:u({id:"pen.categoryName",default:"Pen",description:"Label for the pen extension category"}),blockIconURI:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+cGVuLWljb248L3RpdGxlPjxnIHN0cm9rZT0iIzU3NUU3NSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIGQ9Ik04Ljc1MyAzNC42MDJsLTQuMjUgMS43OCAxLjc4My00LjIzN2MxLjIxOC0yLjg5MiAyLjkwNy01LjQyMyA1LjAzLTcuNTM4TDMxLjA2NiA0LjkzYy44NDYtLjg0MiAyLjY1LS40MSA0LjAzMi45NjcgMS4zOCAxLjM3NSAxLjgxNiAzLjE3My45NyA0LjAxNUwxNi4zMTggMjkuNTljLTIuMTIzIDIuMTE2LTQuNjY0IDMuOC03LjU2NSA1LjAxMiIgZmlsbD0iI0ZGRiIvPjxwYXRoIGQ9Ik0yOS40MSA2LjExcy00LjQ1LTIuMzc4LTguMjAyIDUuNzcyYy0xLjczNCAzLjc2Ni00LjM1IDEuNTQ2LTQuMzUgMS41NDYiLz48cGF0aCBkPSJNMzYuNDIgOC44MjVjMCAuNDYzLS4xNC44NzMtLjQzMiAxLjE2NGwtOS4zMzUgOS4zYy4yODItLjI5LjQxLS42NjguNDEtMS4xMiAwLS44NzQtLjUwNy0xLjk2My0xLjQwNi0yLjg2OC0xLjM2Mi0xLjM1OC0zLjE0Ny0xLjgtNC4wMDItLjk5TDMwLjk5IDUuMDFjLjg0NC0uODQgMi42NS0uNDEgNC4wMzUuOTYuODk4LjkwNCAxLjM5NiAxLjk4MiAxLjM5NiAyLjg1NU0xMC41MTUgMzMuNzc0Yy0uNTczLjMwMi0xLjE1Ny41Ny0xLjc2NC44M0w0LjUgMzYuMzgybDEuNzg2LTQuMjM1Yy4yNTgtLjYwNC41My0xLjE4Ni44MzMtMS43NTcuNjkuMTgzIDEuNDQ4LjYyNSAyLjEwOCAxLjI4Mi42Ni42NTggMS4xMDIgMS40MTIgMS4yODcgMi4xMDIiIGZpbGw9IiM0Qzk3RkYiLz48cGF0aCBkPSJNMzYuNDk4IDguNzQ4YzAgLjQ2NC0uMTQuODc0LS40MzMgMS4xNjVsLTE5Ljc0MiAxOS42OGMtMi4xMyAyLjExLTQuNjczIDMuNzkzLTcuNTcyIDUuMDFMNC41IDM2LjM4bC45NzQtMi4zMTYgMS45MjUtLjgwOGMyLjg5OC0xLjIxOCA1LjQ0LTIuOSA3LjU3LTUuMDFsMTkuNzQzLTE5LjY4Yy4yOTItLjI5Mi40MzItLjcwMi40MzItMS4xNjUgMC0uNjQ2LS4yNy0xLjQtLjc4LTIuMTIyLjI1LjE3Mi41LjM3Ny43MzcuNjE0Ljg5OC45MDUgMS4zOTYgMS45ODMgMS4zOTYgMi44NTYiIGZpbGw9IiM1NzVFNzUiIG9wYWNpdHk9Ii4xNSIvPjxwYXRoIGQ9Ik0xOC40NSAxMi44M2MwIC41LS40MDQuOTA1LS45MDQuOTA1cy0uOTA1LS40MDUtLjkwNS0uOTA0YzAtLjUuNDA3LS45MDMuOTA2LS45MDMuNSAwIC45MDQuNDA0LjkwNC45MDR6IiBmaWxsPSIjNTc1RTc1Ii8+PC9nPjwvc3ZnPg==",blocks:[{blockType:i.LABEL,text:u({id:"tw.pen.stageSelected",default:"Stage selected: less pen blocks",description:"Label that appears in the Pen category when the stage is selected"}),filter:[s.STAGE]},{opcode:"clear",blockType:i.COMMAND,text:u({id:"pen.clear",default:"erase all",description:"erase all pen trails and stamps"})},{opcode:"stamp",blockType:i.COMMAND,text:u({id:"pen.stamp",default:"stamp",description:"render current costume on the background"}),filter:[s.SPRITE]},{opcode:"penDown",blockType:i.COMMAND,text:u({id:"pen.penDown",default:"pen down",description:"start leaving a trail when the sprite moves"}),filter:[s.SPRITE]},{opcode:"penUp",blockType:i.COMMAND,text:u({id:"pen.penUp",default:"pen up",description:"stop leaving a trail behind the sprite"}),filter:[s.SPRITE]},{opcode:"setPenColorToColor",blockType:i.COMMAND,text:u({id:"pen.setColor",default:"set pen color to [COLOR]",description:"set the pen color to a particular (RGB) value"}),arguments:{COLOR:{type:r.COLOR}},filter:[s.SPRITE]},{opcode:"changePenColorParamBy",blockType:i.COMMAND,text:u({id:"pen.changeColorParam",default:"change pen [COLOR_PARAM] by [VALUE]",description:"change the state of a pen color parameter"}),arguments:{COLOR_PARAM:{type:r.STRING,menu:"colorParam",defaultValue:p},VALUE:{type:r.NUMBER,defaultValue:10}},filter:[s.SPRITE]},{opcode:"setPenColorParamTo",blockType:i.COMMAND,text:u({id:"pen.setColorParam",default:"set pen [COLOR_PARAM] to [VALUE]",description:"set the state for a pen color parameter e.g. saturation"}),arguments:{COLOR_PARAM:{type:r.STRING,menu:"colorParam",defaultValue:p},VALUE:{type:r.NUMBER,defaultValue:50}},filter:[s.SPRITE]},{opcode:"changePenSizeBy",blockType:i.COMMAND,text:u({id:"pen.changeSize",default:"change pen size by [SIZE]",description:"change the diameter of the trail left by a sprite"}),arguments:{SIZE:{type:r.NUMBER,defaultValue:1}},filter:[s.SPRITE]},{opcode:"setPenSizeTo",blockType:i.COMMAND,text:u({id:"pen.setSize",default:"set pen size to [SIZE]",description:"set the diameter of a trail left by a sprite"}),arguments:{SIZE:{type:r.NUMBER,defaultValue:1}},filter:[s.SPRITE]},{opcode:"setPenShadeToNumber",blockType:i.COMMAND,text:u({id:"pen.setShade",default:"set pen shade to [SHADE]",description:"legacy pen blocks - set pen shade"}),arguments:{SHADE:{type:r.NUMBER,defaultValue:1}},hideFromPalette:!0},{opcode:"changePenShadeBy",blockType:i.COMMAND,text:u({id:"pen.changeShade",default:"change pen shade by [SHADE]",description:"legacy pen blocks - change pen shade"}),arguments:{SHADE:{type:r.NUMBER,defaultValue:1}},hideFromPalette:!0},{opcode:"setPenHueToNumber",blockType:i.COMMAND,text:u({id:"pen.setHue",default:"set pen color to [HUE]",description:"legacy pen blocks - set pen color to number"}),arguments:{HUE:{type:r.NUMBER,defaultValue:1}},hideFromPalette:!0},{opcode:"changePenHueBy",blockType:i.COMMAND,text:u({id:"pen.changeHue",default:"change pen color by [HUE]",description:"legacy pen blocks - change pen color"}),arguments:{HUE:{type:r.NUMBER,defaultValue:1}},hideFromPalette:!0}],menus:{colorParam:{acceptReporters:!0,items:this._initColorParam()}}}}clear(){const t=this._getPenLayerID();t>=0&&(this.runtime.renderer.penClear(t),this.runtime.requestRedraw())}stamp(t,e){this._stamp(e.target)}_stamp(t){const e=this._getPenLayerID();e>=0&&(this.runtime.renderer.penStamp(e,t.drawableID),this.runtime.requestRedraw())}penDown(t,e){this._penDown(e.target)}_penDown(t){const e=this._getPenState(t);e.penDown||(e.penDown=!0,t.onTargetMoved=this._onTargetMoved);const n=this._getPenLayerID();n>=0&&(this.runtime.renderer.penPoint(n,e.penAttributes,t.x,t.y),this.runtime.requestRedraw())}penUp(t,e){this._penUp(e.target)}_penUp(t){const e=this._getPenState(t);e.penDown&&(e.penDown=!1,t.onTargetMoved=null)}setPenColorToColor(t,e){this._setPenColorToColor(t.COLOR,e.target)}_setPenColorToColor(t,e){const n=this._getPenState(e),r=o.toRgbColorObject(t),i=c.rgbToHsv(r);n.color=i.h/360*100,n.saturation=100*i.s,n.brightness=100*i.v,Object.prototype.hasOwnProperty.call(r,"a")?n.transparency=100*(1-r.a/255):n.transparency=0,n._shade=n.brightness/2,this._updatePenColor(n)}_updatePenColor(t){const e=c.hsvToRgb({h:360*t.color/100,s:t.saturation/100,v:t.brightness/100});t.penAttributes.color4f[0]=e.r/255,t.penAttributes.color4f[1]=e.g/255,t.penAttributes.color4f[2]=e.b/255,t.penAttributes.color4f[3]=this._transparencyToAlpha(t.transparency)}_setOrChangeColorParam(t,e,n,r){switch(t){case p:n.color=this._wrapColor(e+(r?n.color:0));break;case f:n.saturation=this._clampColorParam(e+(r?n.saturation:0));break;case m:n.brightness=this._clampColorParam(e+(r?n.brightness:0));break;case g:n.transparency=this._clampColorParam(e+(r?n.transparency:0));break;default:h.warn("Tried to set or change unknown color parameter: ".concat(t))}this._updatePenColor(n)}changePenColorParamBy(t,e){const n=this._getPenState(e.target);this._setOrChangeColorParam(t.COLOR_PARAM,o.toNumber(t.VALUE),n,!0)}setPenColorParamTo(t,e){const n=this._getPenState(e.target);this._setOrChangeColorParam(t.COLOR_PARAM,o.toNumber(t.VALUE),n,!1)}changePenSizeBy(t,e){this._changePenSizeBy(o.toNumber(t.SIZE),e.target)}_changePenSizeBy(t,e){const n=this._getPenState(e).penAttributes;n.diameter=this._clampPenSize(n.diameter+t)}setPenSizeTo(t,e){this._setPenSizeTo(o.toNumber(t.SIZE),e.target)}_setPenSizeTo(t,e){this._getPenState(e).penAttributes.diameter=this._clampPenSize(t)}setPenHueToNumber(t,e){this._setPenHueToNumber(o.toNumber(t.HUE),e.target)}_setPenHueToNumber(t,e){const n=this._getPenState(e),r=t/2;this._setOrChangeColorParam(p,r,n,!1),this._setOrChangeColorParam(g,0,n,!1),this._legacyUpdatePenColor(n)}changePenHueBy(t,e){this._changePenHueBy(o.toNumber(t.HUE),e.target)}_changePenHueBy(t,e){const n=this._getPenState(e),r=t/2;this._setOrChangeColorParam(p,r,n,!0),this._legacyUpdatePenColor(n)}setPenShadeToNumber(t,e){this._setPenShadeToNumber(o.toNumber(t.SHADE),e.target)}_setPenShadeToNumber(t,e){const n=this._getPenState(e);let r=o.toNumber(t);r%=200,r<0&&(r+=200),n._shade=r,this._legacyUpdatePenColor(n)}changePenShadeBy(t,e){this._changePenShadeBy(t.SHADE,e.target)}_changePenShadeBy(t,e){const n=this._getPenState(e),r=o.toNumber(t);this._setPenShadeToNumber(n._shade+r,e)}_legacyUpdatePenColor(t){let e=c.hsvToRgb({h:360*t.color/100,s:1,v:1});const n=t._shade>100?200-t._shade:t._shade;e=n<50?c.mixRgb(c.RGB_BLACK,e,(10+n)/60):c.mixRgb(e,c.RGB_WHITE,(n-50)/60);const r=c.rgbToHsv(e);t.color=100*r.h/360,t.saturation=100*r.s,t.brightness=100*r.v,this._updatePenColor(t)}}t.exports=b},function(t,e,n){const r=n(3),i=n(2),s=n(1),o=n(5),a=n(20),c=n(28),u=n(14),l=n(4),h=n(37),d=n(0),p="00001523-1212-efde-1523-785feabcd123",f="00004f0e-1212-efde-1523-785feabcd123",m="00001527-1212-efde-1523-785feabcd123",g="00001528-1212-efde-1523-785feabcd123",b="00001560-1212-efde-1523-785feabcd123",y="00001563-1212-efde-1523-785feabcd123",v="00001565-1212-efde-1523-785feabcd123",w=100,T=1,E=23,A=34,k=35,I=6,S=5,x=1,O=2,M=3,N=4,C={TILT:0,DISTANCE:0,LED:1},R={TILT:0,DISTANCE:1,LED:0};class D{constructor(t,e){this._parent=t,this._index=e,this._direction=1,this._power=100,this._isOn=!1,this._pendingTimeoutId=null,this._pendingTimeoutStartTime=null,this._pendingTimeoutDelay=null,this.startBraking=this.startBraking.bind(this),this.turnOff=this.turnOff.bind(this)}static get BRAKE_TIME_MS(){return 1e3}get direction(){return this._direction}set direction(t){this._direction=t<0?-1:1}get power(){return this._power}set power(t){const e=Math.max(0,Math.min(t,100));if(0===e)this._power=0;else{const t=100/e;this._power=30+70/t}}get isOn(){return this._isOn}get pendingTimeoutStartTime(){return this._pendingTimeoutStartTime}get pendingTimeoutDelay(){return this._pendingTimeoutDelay}turnOn(){const t=this._parent.generateOutputCommand(this._index+1,x,[this._power*this._direction]);this._parent.send(v,t),this._isOn=!0,this._clearTimeout()}turnOnFor(t){0!==this._power&&(t=Math.max(0,t),this.turnOn(),this._setNewTimeout(this.startBraking,t))}startBraking(){if(0===this._power)return;const t=this._parent.generateOutputCommand(this._index+1,x,[127]);this._parent.send(v,t),this._isOn=!1,this._setNewTimeout(this.turnOff,D.BRAKE_TIME_MS)}turnOff(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(0===this._power)return;const e=this._parent.generateOutputCommand(this._index+1,x,[0]);this._parent.send(v,e,t),this._isOn=!1}_clearTimeout(){null!==this._pendingTimeoutId&&(clearTimeout(this._pendingTimeoutId),this._pendingTimeoutId=null,this._pendingTimeoutStartTime=null,this._pendingTimeoutDelay=null)}_setNewTimeout(t,e){this._clearTimeout();const n=setTimeout((()=>{this._pendingTimeoutId===n&&(this._pendingTimeoutId=null,this._pendingTimeoutStartTime=null,this._pendingTimeoutDelay=null),t()}),e);this._pendingTimeoutId=n,this._pendingTimeoutStartTime=Date.now(),this._pendingTimeoutDelay=e}}class P{constructor(t,e){this._runtime=t,this._runtime.on("PROJECT_STOP_ALL",this.stopAll.bind(this)),this._extensionId=e,this._ports=["none","none"],this._motors=[null,null],this._sensors={tiltX:0,tiltY:0,distance:0},this._ble=null,this._runtime.registerPeripheralExtension(e,this),this._rateLimiter=new h(20),this._batteryLevelIntervalId=null,this.reset=this.reset.bind(this),this._onConnect=this._onConnect.bind(this),this._onMessage=this._onMessage.bind(this),this._checkBatteryLevel=this._checkBatteryLevel.bind(this)}get tiltX(){return this._sensors.tiltX}get tiltY(){return this._sensors.tiltY}get distance(){return this._sensors.distance}motor(t){return this._motors[t]}stopAllMotors(){this._motors.forEach((t=>{t&&t.turnOff(!1)}))}setLED(t){const e=[t>>16&255,t>>8&255,255&t],n=this.generateOutputCommand(I,N,e);return this.send(v,n)}setLEDMode(){const t=this.generateInputCommand(I,E,C.LED,0,R.LED,!1);return this.send(y,t)}stopLED(){const t=this.generateOutputCommand(I,N,[0,0,0]);return this.send(v,t)}playTone(t,e){const n=this.generateOutputCommand(S,O,[t,t>>8,e,e>>8]);return this.send(v,n)}stopTone(){const t=this.generateOutputCommand(S,M);return this.send(v,t,!1)}stopAll(){this.isConnected()&&(this.stopTone(),this.stopAllMotors())}scan(){this._ble&&this._ble.disconnect(),this._ble=new c(this._runtime,this._extensionId,{filters:[{services:[p]}],optionalServices:[f]},this._onConnect,this.reset)}connect(t){this._ble&&this._ble.connectPeripheral(t)}disconnect(){this._ble&&this._ble.disconnect(),this.reset()}reset(){this._ports=["none","none"],this._motors=[null,null],this._sensors={tiltX:0,tiltY:0,distance:0},this._batteryLevelIntervalId&&(window.clearInterval(this._batteryLevelIntervalId),this._batteryLevelIntervalId=null)}isConnected(){let t=!1;return this._ble&&(t=this._ble.isConnected()),t}send(t,e){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.isConnected()?n&&!this._rateLimiter.okayToSend()?Promise.resolve():this._ble.write(f,t,u.uint8ArrayToBase64(e),"base64"):Promise.resolve()}generateOutputCommand(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=[t,e];return n&&(r=r.concat(n.length).concat(n)),r}generateInputCommand(t,e,n,r,i,s){return[1,2,t,e,n,r,0,0,0,i,s?1:0]}_onConnect(){this.setLEDMode(),this.setLED(255),this._ble.startNotifications(p,m,this._onMessage),this._batteryLevelIntervalId=window.setInterval(this._checkBatteryLevel,5e3)}_onMessage(t){const e=u.base64ToUint8Array(t);switch(e[0]){case 1:case 2:{const t=e[0];0===e[1]?this._clearPort(t):this._registerSensorOrMotor(t,e[3]);break}default:{const t=e[1],n=this._ports[t-1];n===k&&(this._sensors.distance=e[2]),n===A&&(this._sensors.tiltX=e[2],this._sensors.tiltY=e[3]);break}}}_checkBatteryLevel(){this._ble.read(p,g,!1)}_registerSensorOrMotor(t,e){if(this._ports[t-1]=e,e===T)this._motors[t-1]=new D(this,t-1);else{const n=e===k?"DISTANCE":"TILT",r=this.generateInputCommand(t,e,C[n],1,R[n],!0);this.send(y,r),this._ble.startNotifications(f,b,this._onMessage)}}_clearPort(t){const e=this._ports[t-1];e===A&&(this._sensors.tiltX=this._sensors.tiltY=0),e===k&&(this._sensors.distance=0),this._ports[t-1]="none",this._motors[t-1]=null}}const L="motor",B="motor A",U="motor B",j="all motors",F="this way",z="that way",V="reverse",G="up",Y="down",H="left",W="right",K="any";class q{static get EXTENSION_ID(){return"wedo2"}static get TILT_THRESHOLD(){return 15}constructor(t){this.runtime=t,this._peripheral=new P(this.runtime,q.EXTENSION_ID)}getInfo(){return{id:q.EXTENSION_ID,name:"WeDo 2.0",blockIconURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAACXBIWXMAABYlAAAWJQFJUiTwAAAF8klEQVR4Ae2cbWxTVRjH/7ctbVc2tyEMNpWBk0VIkLcEjSAQgglTE5HEaKqJi1E/mbCP/dJA0kQbvzgTQ0Ki2T7V6AeYGoEPLJmGKPiyzZDwEpYJCHSbQIcbdLvres1zOa13Xbvdu2eTDp9fst329Lnn5XfPPfece7tphmFAmDkuccdDBDIRgUxEIBMRyEQEMhGBTEQgExHIRAQyEYFMRCATEchEBDIRgUxEIBMRyEQEMhGBTEQgExHIxMPNIByNVQBoBUDb7kgo2KTS9wBoUmFNkVCwW6U3A1gP4JJKHwxHY/S+WcW2RkLBVhV7AMAOAIMAGlWstbyOSCh4QMU2Uoy1PBVL+a7IqZu1vOZIKNg20/azBarGvKxebw9HY22RULADwBFLTBcATQnZl4lVEimN4ssteXQrQfstebQpmW1q30xshyqvxRLbofYnYW9ZYgeV8C5LLOWlzbTxM3ouHI7GPgSwWx3Z0syBSBku6IYnlTbM+uQenJQaMnKHDaqAFnDrcCFbl3G1defEjas0a4N/Vz10OybyvapfrSX1sjpo+WIz0ME7QL3djgtHPTAcjb2mepw/b2ZaGh5NL5RnofR8R99dIC5fHusK5JsrCUpm7TSx21XvbcwTNwnbAsPR2GcA3qaG+H0LsHlDPZ7fca/ujZ+cRW9/Em5vCXzlNVhQUjFpf/3OTSRvXkKJz43Xt1bh1S1LUeq/5+njQ9/iVmLIfL1ieRU2b1iFtavztXNu6TrTi8PfnYI67WdPoOp5przV9Y8iuHdb9rOW9uumPI+vDIElddBckztPOqVn5X36Xj1WVQeynx1sOWbK83jc2PviM/dFXIYNax9H55leXLoyYHsfWwI14JCRRx7x5ckBU1oheYQ+1G9u39lVM0Hej7+cR7w/Yb7e9+5LqChfaLvixcK088BwNNZkAOV02ubK6+odwt3RcfOULSSPGEveG48bNj08If3kqXPmdtO6unkpDzYn0u/TLxrzcumJJ80Ut79sygzoFF6/siw75mUYupOEpmnY0/A0pw33FTsCa+hX5oJhZXgkZb5zub2O20CnL7EwkPeCPm+wI7CEBvi5wuOZ36tJW7X3uGXJXAgxk8P4eNpRPEvgskqfuR0Z/BNGejxvDM3/5gs0pboWv+motqybCc+tqUCzz43kaBJ/X+2eMjZ3ClNsjIzo5ioknXZ2b4AlkKYltLJoaY9jOJm/B0KJbtg4c4F/XOmH3+dF9dLKbBo1OD6QQGV56YQ55ODtO0jcHkZ1VSX8/n9nB9S7RkZ1rFy+NG8ZR9s70TeQQKDEh7vJUdt1Y9/OopXFB2/WcbMpyOexE9mlFS21aLlHMmKHfzBl0QT/hV2bzM9oLXv0xG8YGR0zpdLEn6RT2k+/XjDzoLX2G3u3TZBLUyral/Z5qCyAK1f/sl2/or+IWNel1Eji3MWrpjyCZHWqdNrSe6ieSHFERl4mP+q5GehgHGvvRGal5XI5uzU47f3A/R99YTgdF2wXrmkolr9ToZ5NvTjT4yOhoC2T057CJM/r9WDxoqmXa07R9THcuDVcMO8bt4ag6ynULKvkFjWBTLl0ugZKvNlyqLeSQKfYGgOpgXt2b5zVhlzrS+Dr451YvKg0b95txztxvS8xZ+VuXFuLJ5+oNgV+9c3PuHDxGs6cu+w4v//9RJo6x5bN9UgbBo4cPY1U6j+cSD8orFvzGFYuX4KxsRQGbth6FCICc9m5dY05HtN46AQRqPB5PWjY+ZT5RnMwkxGBFh5ZVmle9Z3MrGbjwfqccrC1vajrV7QCaVCfS6qrJj96nQlFK5CujPRT7MgYyEQEMhGBTGwJpAW4kJ9pBbo0zbx70X7y7AOv8HxP3LyB4YTpb2cZBt2iqL3QEwf9zDbX+waLca439QMeC7a+YBmOxugLiM/OTt2yaOoMoO+H6LOcNwf6xusrthsh/7mIh1yFmYhAJiKQiQhkIgKZiEAmIpCJCGQiApmIQCYikIkIZCICmYhAJiKQiQhkIgKZiEAmIpCJCGQiAjkA+AeOwQKMcWZqHgAAAABJRU5ErkJggg==",showStatusButton:!0,blocks:[{opcode:"motorOnFor",text:o({id:"wedo2.motorOnFor",default:"turn [MOTOR_ID] on for [DURATION] seconds",description:"turn a motor on for some time"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:L},DURATION:{type:r.NUMBER,defaultValue:1}}},{opcode:"motorOn",text:o({id:"wedo2.motorOn",default:"turn [MOTOR_ID] on",description:"turn a motor on indefinitely"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:L}}},{opcode:"motorOff",text:o({id:"wedo2.motorOff",default:"turn [MOTOR_ID] off",description:"turn a motor off"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:L}}},{opcode:"startMotorPower",text:o({id:"wedo2.startMotorPower",default:"set [MOTOR_ID] power to [POWER]",description:"set the motor's power and turn it on"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:L},POWER:{type:r.NUMBER,defaultValue:100}}},{opcode:"setMotorDirection",text:o({id:"wedo2.setMotorDirection",default:"set [MOTOR_ID] direction to [MOTOR_DIRECTION]",description:"set the motor's turn direction"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:L},MOTOR_DIRECTION:{type:r.STRING,menu:"MOTOR_DIRECTION",defaultValue:F}}},{opcode:"setLightHue",text:o({id:"wedo2.setLightHue",default:"set light color to [HUE]",description:"set the LED color"}),blockType:i.COMMAND,arguments:{HUE:{type:r.NUMBER,defaultValue:50}}},{opcode:"playNoteFor",text:o({id:"wedo2.playNoteFor",default:"play note [NOTE] for [DURATION] seconds",description:"play a certain note for some time"}),blockType:i.COMMAND,arguments:{NOTE:{type:r.NUMBER,defaultValue:60},DURATION:{type:r.NUMBER,defaultValue:.5}},hideFromPalette:!0},{opcode:"whenDistance",text:o({id:"wedo2.whenDistance",default:"when distance [OP] [REFERENCE]",description:"check for when distance is < or > than reference"}),blockType:i.HAT,arguments:{OP:{type:r.STRING,menu:"OP",defaultValue:"<"},REFERENCE:{type:r.NUMBER,defaultValue:50}}},{opcode:"whenTilted",text:o({id:"wedo2.whenTilted",default:"when tilted [TILT_DIRECTION_ANY]",description:"check when tilted in a certain direction"}),func:"isTilted",blockType:i.HAT,arguments:{TILT_DIRECTION_ANY:{type:r.STRING,menu:"TILT_DIRECTION_ANY",defaultValue:K}}},{opcode:"getDistance",text:o({id:"wedo2.getDistance",default:"distance",description:"the value returned by the distance sensor"}),blockType:i.REPORTER},{opcode:"isTilted",text:o({id:"wedo2.isTilted",default:"tilted [TILT_DIRECTION_ANY]?",description:"whether the tilt sensor is tilted"}),blockType:i.BOOLEAN,arguments:{TILT_DIRECTION_ANY:{type:r.STRING,menu:"TILT_DIRECTION_ANY",defaultValue:K}}},{opcode:"getTiltAngle",text:o({id:"wedo2.getTiltAngle",default:"tilt angle [TILT_DIRECTION]",description:"the angle returned by the tilt sensor"}),blockType:i.REPORTER,arguments:{TILT_DIRECTION:{type:r.STRING,menu:"TILT_DIRECTION",defaultValue:G}}}],menus:{MOTOR_ID:{acceptReporters:!0,items:[{text:o({id:"wedo2.motorId.default",default:"motor",description:"label for motor element in motor menu for LEGO WeDo 2 extension"}),value:L},{text:o({id:"wedo2.motorId.a",default:"motor A",description:"label for motor A element in motor menu for LEGO WeDo 2 extension"}),value:B},{text:o({id:"wedo2.motorId.b",default:"motor B",description:"label for motor B element in motor menu for LEGO WeDo 2 extension"}),value:U},{text:o({id:"wedo2.motorId.all",default:"all motors",description:"label for all motors element in motor menu for LEGO WeDo 2 extension"}),value:j}]},MOTOR_DIRECTION:{acceptReporters:!0,items:[{text:o({id:"wedo2.motorDirection.forward",default:"this way",description:"label for forward element in motor direction menu for LEGO WeDo 2 extension"}),value:F},{text:o({id:"wedo2.motorDirection.backward",default:"that way",description:"label for backward element in motor direction menu for LEGO WeDo 2 extension"}),value:z},{text:o({id:"wedo2.motorDirection.reverse",default:"reverse",description:"label for reverse element in motor direction menu for LEGO WeDo 2 extension"}),value:V}]},TILT_DIRECTION:{acceptReporters:!0,items:[{text:o({id:"wedo2.tiltDirection.up",default:"up",description:"label for up element in tilt direction menu for LEGO WeDo 2 extension"}),value:G},{text:o({id:"wedo2.tiltDirection.down",default:"down",description:"label for down element in tilt direction menu for LEGO WeDo 2 extension"}),value:Y},{text:o({id:"wedo2.tiltDirection.left",default:"left",description:"label for left element in tilt direction menu for LEGO WeDo 2 extension"}),value:H},{text:o({id:"wedo2.tiltDirection.right",default:"right",description:"label for right element in tilt direction menu for LEGO WeDo 2 extension"}),value:W}]},TILT_DIRECTION_ANY:{acceptReporters:!0,items:[{text:o({id:"wedo2.tiltDirection.up",default:"up"}),value:G},{text:o({id:"wedo2.tiltDirection.down",default:"down"}),value:Y},{text:o({id:"wedo2.tiltDirection.left",default:"left"}),value:H},{text:o({id:"wedo2.tiltDirection.right",default:"right"}),value:W},{text:o({id:"wedo2.tiltDirection.any",default:"any",description:"label for any element in tilt direction menu for LEGO WeDo 2 extension"}),value:K}]},OP:{acceptReporters:!0,items:["<",">"]}}}}motorOnFor(t){let e=1e3*s.toNumber(t.DURATION);return e=l.clamp(e,0,15e3),new Promise((n=>{this._forEachMotor(t.MOTOR_ID,(t=>{const n=this._peripheral.motor(t);n&&n.turnOnFor(e)})),setTimeout(n,e)}))}motorOn(t){return this._forEachMotor(t.MOTOR_ID,(t=>{const e=this._peripheral.motor(t);e&&e.turnOn()})),new Promise((t=>{window.setTimeout((()=>{t()}),w)}))}motorOff(t){return this._forEachMotor(t.MOTOR_ID,(t=>{const e=this._peripheral.motor(t);e&&e.turnOff()})),new Promise((t=>{window.setTimeout((()=>{t()}),w)}))}startMotorPower(t){return this._forEachMotor(t.MOTOR_ID,(e=>{const n=this._peripheral.motor(e);n&&(n.power=l.clamp(s.toNumber(t.POWER),0,100),n.turnOn())})),new Promise((t=>{window.setTimeout((()=>{t()}),w)}))}setMotorDirection(t){return this._forEachMotor(t.MOTOR_ID,(e=>{const n=this._peripheral.motor(e);if(n){switch(t.MOTOR_DIRECTION){case F:n.direction=1;break;case z:n.direction=-1;break;case V:n.direction=-n.direction;break;default:d.warn("Unknown motor direction in setMotorDirection: ".concat(t.DIRECTION))}n.isOn&&(n.pendingTimeoutDelay?n.turnOnFor(n.pendingTimeoutStartTime+n.pendingTimeoutDelay-Date.now()):n.turnOn())}})),new Promise((t=>{window.setTimeout((()=>{t()}),w)}))}setLightHue(t){let e=s.toNumber(t.HUE);e=l.wrapClamp(e,0,100);const n=360*e/100,r=a.hsvToRgb({h:n,s:1,v:1}),i=a.rgbToDecimal(r);return this._peripheral.setLED(i),new Promise((t=>{window.setTimeout((()=>{t()}),w)}))}playNoteFor(t){let e=1e3*s.toNumber(t.DURATION);e=l.clamp(e,0,3e3);const n=l.clamp(s.toNumber(t.NOTE),25,125);if(0!==e)return new Promise((t=>{const r=this._noteToTone(n);this._peripheral.playTone(r,e),setTimeout(t,e)}))}whenDistance(t){switch(t.OP){case"<":return this._peripheral.distance<s.toNumber(t.REFERENCE);case">":return this._peripheral.distance>s.toNumber(t.REFERENCE);default:return d.warn("Unknown comparison operator in whenDistance: ".concat(t.OP)),!1}}whenTilted(t){return this._isTilted(t.TILT_DIRECTION_ANY)}getDistance(){return this._peripheral.distance}isTilted(t){return this._isTilted(t.TILT_DIRECTION_ANY)}getTiltAngle(t){return this._getTiltAngle(t.TILT_DIRECTION)}_isTilted(t){return t===K?this._getTiltAngle(G)>=q.TILT_THRESHOLD||this._getTiltAngle(Y)>=q.TILT_THRESHOLD||this._getTiltAngle(H)>=q.TILT_THRESHOLD||this._getTiltAngle(W)>=q.TILT_THRESHOLD:this._getTiltAngle(t)>=q.TILT_THRESHOLD}_getTiltAngle(t){switch(t){case G:return this._peripheral.tiltY>45?256-this._peripheral.tiltY:-this._peripheral.tiltY;case Y:return this._peripheral.tiltY>45?this._peripheral.tiltY-256:this._peripheral.tiltY;case H:return this._peripheral.tiltX>45?256-this._peripheral.tiltX:-this._peripheral.tiltX;case W:return this._peripheral.tiltX>45?this._peripheral.tiltX-256:this._peripheral.tiltX;default:d.warn("Unknown tilt direction in _getTiltAngle: ".concat(t))}}_forEachMotor(t,e){let n;switch(t){case B:n=[0];break;case U:n=[1];break;case j:case L:n=[0,1];break;default:d.warn("Invalid motor ID: ".concat(t)),n=[]}for(const t of n)e(t)}_noteToTone(t){return 440*Math.pow(2,(t-69)/12)}}t.exports=q},function(t,e,n){(function(t,e){!function(n){"use strict";var r,i="function"==typeof(r=n.atob)?r:"function"==typeof t?function(e){return new t(e,"base64").toString("binary")}:"object"==typeof n.base64js?function(t){var e=n.base64js.b64ToByteArray(t);return Array.prototype.map.call(e,(function(t){return String.fromCharCode(t)})).join("")}:function(){throw new Error("You're probably in an old browser or an iOS webworker. It might help to include beatgammit's base64-js.")};n.atob=i,e&&e.exports&&(e.exports=i)}(window)}).call(this,n(16).Buffer,n(113)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){(function(e){!function(){"use strict";t.exports=function(t){return(t instanceof e?t:e.from(t.toString(),"binary")).toString("base64")}}()}).call(this,n(16).Buffer)},function(t,e,n){const r=n(3),i=n(2),s=n(11),o=n(1),a=n(5),c=n(4),u=n(13);let l={};try{l=n(116)}catch(t){}class h{constructor(t){this.runtime=t,this._concurrencyCounter=0,this._drumPlayers=[],this._instrumentPlayerArrays=[],this._instrumentPlayerNoteArrays=[],this._bufferSources=[],this._loadAllSounds(),this._onTargetCreated=this._onTargetCreated.bind(this),this.runtime.on("targetWasCreated",this._onTargetCreated),this._playNoteForPicker=this._playNoteForPicker.bind(this),this.runtime.on("PLAY_NOTE",this._playNoteForPicker)}_loadAllSounds(){const t=[];this.DRUM_INFO.forEach(((e,n)=>{const r="drums/".concat(e.fileName),i=this._storeSound(r,n,this._drumPlayers);t.push(i)})),this.INSTRUMENT_INFO.forEach(((e,n)=>{this._instrumentPlayerArrays[n]=[],this._instrumentPlayerNoteArrays[n]=[],e.samples.forEach(((r,i)=>{const s="instruments/".concat(e.dirName,"/").concat(r),o=this._storeSound(s,i,this._instrumentPlayerArrays[n]);t.push(o)}))})),Promise.all(t).then((()=>{}))}_storeSound(t,e,n){const r="".concat(t,".mp3");if(!l[r])return;const i=l[r];return fetch(i).then((t=>t.arrayBuffer())).then((t=>this._decodeSound(t))).then((t=>{n[e]=t}))}_decodeSound(t){const e=this.runtime.audioEngine;return e?e.decodeSoundPlayer({data:{buffer:t}}):Promise.reject(new Error("No Audio Context Detected"))}_buildMenu(t){return t.map(((t,e)=>{const n={};return n.text=t.name,n.value=String(e+1),n}))}get DRUM_INFO(){return[{name:a({id:"music.drumSnare",default:"(1) Snare Drum",description:"Sound of snare drum as used in a standard drum kit"}),fileName:"1-snare"},{name:a({id:"music.drumBass",default:"(2) Bass Drum",description:"Sound of bass drum as used in a standard drum kit"}),fileName:"2-bass-drum"},{name:a({id:"music.drumSideStick",default:"(3) Side Stick",description:"Sound of a drum stick hitting the side of a drum (usually the snare)"}),fileName:"3-side-stick"},{name:a({id:"music.drumCrashCymbal",default:"(4) Crash Cymbal",description:"Sound of a drum stick hitting a crash cymbal"}),fileName:"4-crash-cymbal"},{name:a({id:"music.drumOpenHiHat",default:"(5) Open Hi-Hat",description:"Sound of a drum stick hitting a hi-hat while open"}),fileName:"5-open-hi-hat"},{name:a({id:"music.drumClosedHiHat",default:"(6) Closed Hi-Hat",description:"Sound of a drum stick hitting a hi-hat while closed"}),fileName:"6-closed-hi-hat"},{name:a({id:"music.drumTambourine",default:"(7) Tambourine",description:"Sound of a tambourine being struck"}),fileName:"7-tambourine"},{name:a({id:"music.drumHandClap",default:"(8) Hand Clap",description:"Sound of two hands clapping together"}),fileName:"8-hand-clap"},{name:a({id:"music.drumClaves",default:"(9) Claves",description:"Sound of claves being struck together"}),fileName:"9-claves"},{name:a({id:"music.drumWoodBlock",default:"(10) Wood Block",description:"Sound of a wood block being struck"}),fileName:"10-wood-block"},{name:a({id:"music.drumCowbell",default:"(11) Cowbell",description:"Sound of a cowbell being struck"}),fileName:"11-cowbell"},{name:a({id:"music.drumTriangle",default:"(12) Triangle",description:"Sound of a triangle (instrument) being struck"}),fileName:"12-triangle"},{name:a({id:"music.drumBongo",default:"(13) Bongo",description:"Sound of a bongo being struck"}),fileName:"13-bongo"},{name:a({id:"music.drumConga",default:"(14) Conga",description:"Sound of a conga being struck"}),fileName:"14-conga"},{name:a({id:"music.drumCabasa",default:"(15) Cabasa",description:"Sound of a cabasa being shaken"}),fileName:"15-cabasa"},{name:a({id:"music.drumGuiro",default:"(16) Guiro",description:"Sound of a guiro being played"}),fileName:"16-guiro"},{name:a({id:"music.drumVibraslap",default:"(17) Vibraslap",description:"Sound of a Vibraslap being played"}),fileName:"17-vibraslap"},{name:a({id:"music.drumCuica",default:"(18) Cuica",description:"Sound of a cuica being played"}),fileName:"18-cuica"}]}get INSTRUMENT_INFO(){return[{name:a({id:"music.instrumentPiano",default:"(1) Piano",description:"Sound of a piano"}),dirName:"1-piano",releaseTime:.5,samples:[24,36,48,60,72,84,96,108]},{name:a({id:"music.instrumentElectricPiano",default:"(2) Electric Piano",description:"Sound of an electric piano"}),dirName:"2-electric-piano",releaseTime:.5,samples:[60]},{name:a({id:"music.instrumentOrgan",default:"(3) Organ",description:"Sound of an organ"}),dirName:"3-organ",releaseTime:.5,samples:[60]},{name:a({id:"music.instrumentGuitar",default:"(4) Guitar",description:"Sound of an accoustic guitar"}),dirName:"4-guitar",releaseTime:.5,samples:[60]},{name:a({id:"music.instrumentElectricGuitar",default:"(5) Electric Guitar",description:"Sound of an electric guitar"}),dirName:"5-electric-guitar",releaseTime:.5,samples:[60]},{name:a({id:"music.instrumentBass",default:"(6) Bass",description:"Sound of an accoustic upright bass"}),dirName:"6-bass",releaseTime:.25,samples:[36,48]},{name:a({id:"music.instrumentPizzicato",default:"(7) Pizzicato",description:"Sound of a string instrument (e.g. violin) being plucked"}),dirName:"7-pizzicato",releaseTime:.25,samples:[60]},{name:a({id:"music.instrumentCello",default:"(8) Cello",description:"Sound of a cello being played with a bow"}),dirName:"8-cello",releaseTime:.1,samples:[36,48,60]},{name:a({id:"music.instrumentTrombone",default:"(9) Trombone",description:"Sound of a trombone being played"}),dirName:"9-trombone",samples:[36,48,60]},{name:a({id:"music.instrumentClarinet",default:"(10) Clarinet",description:"Sound of a clarinet being played"}),dirName:"10-clarinet",samples:[48,60]},{name:a({id:"music.instrumentSaxophone",default:"(11) Saxophone",description:"Sound of a saxophone being played"}),dirName:"11-saxophone",samples:[36,60,84]},{name:a({id:"music.instrumentFlute",default:"(12) Flute",description:"Sound of a flute being played"}),dirName:"12-flute",samples:[60,72]},{name:a({id:"music.instrumentWoodenFlute",default:"(13) Wooden Flute",description:"Sound of a wooden flute being played"}),dirName:"13-wooden-flute",samples:[60,72]},{name:a({id:"music.instrumentBassoon",default:"(14) Bassoon",description:"Sound of a bassoon being played"}),dirName:"14-bassoon",samples:[36,48,60]},{name:a({id:"music.instrumentChoir",default:"(15) Choir",description:"Sound of a choir singing"}),dirName:"15-choir",releaseTime:.25,samples:[48,60,72]},{name:a({id:"music.instrumentVibraphone",default:"(16) Vibraphone",description:"Sound of a vibraphone being struck"}),dirName:"16-vibraphone",releaseTime:.5,samples:[60,72]},{name:a({id:"music.instrumentMusicBox",default:"(17) Music Box",description:"Sound of a music box playing"}),dirName:"17-music-box",releaseTime:.25,samples:[60]},{name:a({id:"music.instrumentSteelDrum",default:"(18) Steel Drum",description:"Sound of a steel drum being struck"}),dirName:"18-steel-drum",releaseTime:.5,samples:[60]},{name:a({id:"music.instrumentMarimba",default:"(19) Marimba",description:"Sound of a marimba being struck"}),dirName:"19-marimba",samples:[60]},{name:a({id:"music.instrumentSynthLead",default:"(20) Synth Lead",description:'Sound of a "lead" synthesizer being played'}),dirName:"20-synth-lead",releaseTime:.1,samples:[60]},{name:a({id:"music.instrumentSynthPad",default:"(21) Synth Pad",description:'Sound of a "pad" synthesizer being played'}),dirName:"21-synth-pad",releaseTime:.25,samples:[60]}]}get MIDI_INSTRUMENTS(){return[1,1,1,1,2,2,4,4,17,17,17,16,19,16,17,17,3,3,3,3,3,3,3,3,4,4,5,5,5,5,5,5,6,6,6,6,6,6,6,6,8,8,8,8,8,7,8,19,8,8,8,8,15,15,15,19,9,9,9,9,9,9,9,9,11,11,11,11,14,14,14,10,12,12,13,13,13,13,12,12,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,4,4,4,4,17,14,8,10,17,17,18,19,1,1,1,1,21,21,21,21,21,21,21,21]}get MIDI_DRUMS(){return[[1,-4],[1,0],[2,0],[0,0],[7,0],[0,2],[1,-6,4],[5,0],[1,-3,3.2],[5,0],[1,0,3],[4,-8],[1,4,3],[1,7,2.7],[3,-8],[1,10,2.7],[4,-2],[3,-11],[4,2],[6,0],[3,0,3.5],[10,0],[3,-8,3.5],[16,-6],[4,2],[12,2],[12,0],[13,0,.2],[13,0,2],[13,-5,2],[12,12],[12,5],[10,19],[10,12],[14,0],[14,0],[17,12],[17,5],[15,0],[15,0],[8,0],[9,0],[9,-4],[17,-5],[17,0],[11,-6,1],[11,-6,3]]}static get STATE_KEY(){return"Scratch.music"}static get DEFAULT_MUSIC_STATE(){return{currentInstrument:0}}static get MIDI_NOTE_RANGE(){return{min:0,max:130}}static get BEAT_RANGE(){return{min:0,max:100}}static get TEMPO_RANGE(){return{min:20,max:500}}static get CONCURRENCY_LIMIT(){return 30}_getMusicState(t){let e=t.getCustomState(h.STATE_KEY);return e||(e=s.simple(h.DEFAULT_MUSIC_STATE),t.setCustomState(h.STATE_KEY,e)),e}_onTargetCreated(t,e){if(e){const n=e.getCustomState(h.STATE_KEY);n&&t.setCustomState(h.STATE_KEY,s.simple(n))}}getInfo(){return{id:"music",name:a({id:"music.categoryName",default:"Music",description:"Label for the Music extension category"}),menuIconURI:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTE2LjA5IDEyLjkzN2MuMjI4IDEuMTQxLS44MzMgMi4wNjMtMi4zNzMgMi4wNjMtMS41MzUgMC0yLjk2Mi0uOTIyLTMuMTg2LTIuMDYzLS4yMy0xLjE0Mi44MzMtMi4wNjggMi4zNzItMi4wNjguMzIzIDAgLjY0MS4wNDIuOTQ1LjExN2EzLjUgMy41IDAgMCAxIC40NjguMTUxYy40MzUtLjAxLS4wNTItMS4xNDctLjkxNy02LjExNC0xLjA2Ny02LjE1MiAxLjUzLS45MzUgNC4zODQtMS4zNzcgMi44NTQtLjQ0Mi4wMzggMi40MS0xLjgyNSAxLjkyMi0xLjg2Mi0uNDkzLTIuMzI1LTMuNTc3LjEzMiA3LjM3ek03LjQ2IDguNTYzYy0xLjg2Mi0uNDkzLTIuMzI1LTMuNTc2LjEzIDcuMzdDNy44MTYgMTcuMDczIDYuNzU0IDE4IDUuMjIgMThjLTEuNTM1IDAtMi45NjEtLjkyNi0zLjE5LTIuMDY4LS4yMjQtMS4xNDIuODM3LTIuMDY3IDIuMzc1LTIuMDY3LjUwMSAwIC45ODcuMDk4IDEuNDI3LjI3Mi40MTItLjAyOC0uMDc0LTEuMTg5LS45My02LjExNEMzLjgzNCAxLjg3IDYuNDMgNy4wODcgOS4yODIgNi42NDZjMi44NTQtLjQ0Ny4wMzggMi40MS0xLjgyMyAxLjkxN3oiIGZpbGw9IiM1NzVFNzUiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==",blockIconURI:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PHRpdGxlPm11c2ljLWJsb2NrLWljb248L3RpdGxlPjxkZWZzPjxwYXRoIGQ9Ik0zMi4xOCAyNS44NzRDMzIuNjM2IDI4LjE1NyAzMC41MTIgMzAgMjcuNDMzIDMwYy0zLjA3IDAtNS45MjMtMS44NDMtNi4zNzItNC4xMjYtLjQ1OC0yLjI4NSAxLjY2NS00LjEzNiA0Ljc0My00LjEzNi42NDcgMCAxLjI4My4wODQgMS44OS4yMzQuMzM4LjA4Ni42MzcuMTguOTM4LjMwMi44Ny0uMDItLjEwNC0yLjI5NC0xLjgzNS0xMi4yMy0yLjEzNC0xMi4zMDIgMy4wNi0xLjg3IDguNzY4LTIuNzUyIDUuNzA4LS44ODUuMDc2IDQuODItMy42NSAzLjg0NC0zLjcyNC0uOTg3LTQuNjUtNy4xNTMuMjYzIDE0LjczOHptLTE2Ljk5OCA1Ljk5QzE1LjYzIDM0LjE0OCAxMy41MDcgMzYgMTAuNDQgMzZjLTMuMDcgMC01LjkyMi0xLjg1Mi02LjM4LTQuMTM2LS40NDgtMi4yODQgMS42NzQtNC4xMzUgNC43NS00LjEzNSAxLjAwMyAwIDEuOTc1LjE5NiAyLjg1NS41NDMuODIyLS4wNTUtLjE1LTIuMzc3LTEuODYyLTEyLjIyOC0yLjEzMy0xMi4zMDMgMy4wNi0xLjg3IDguNzY0LTIuNzUzIDUuNzA2LS44OTQuMDc2IDQuODItMy42NDggMy44MzQtMy43MjQtLjk4Ny00LjY1LTcuMTUyLjI2MiAxNC43Mzh6IiBpZD0iYSIvPjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjx1c2UgZmlsbD0iI0ZGRiIgeGxpbms6aHJlZj0iI2EiLz48cGF0aCBzdHJva2Utb3BhY2l0eT0iLjEiIHN0cm9rZT0iIzAwMCIgZD0iTTI4LjQ1NiAyMS42NzVjLS4wMS0uMzEyLS4wODctLjgyNS0uMjU2LTEuNzAyLS4wOTYtLjQ5NS0uNjEyLTMuMDIyLS43NTMtMy43My0uMzk1LTEuOTgtLjc2LTMuOTItMS4xNDItNi4xMTMtLjczMi00LjIyMy0uNjkzLTYuMDUuMzQ0LTYuNTI3LjUtLjIzIDEuMDYtLjA4IDEuODQuMzUuNDE0LjIyNyAyLjE4MiAxLjM2NSAyLjA3IDEuMjk2IDEuOTk0IDEuMjQyIDMuNDY0IDEuNzc0IDQuOTMgMS41NDggMS41MjYtLjIzNyAyLjUwNC0uMDYgMi44NzYuNjE4LjM0OC42MzUuMDE1IDEuNDE2LS43MyAyLjE4LTEuNDcyIDEuNTE2LTMuOTc1IDIuNTE0LTUuODQ4IDIuMDIzLS44MjItLjIyLTEuMjM4LS40NjUtMi4zOC0xLjI2N2wtLjA5NS0uMDY2Yy4wNDcuNTkzLjI2NCAxLjc0LjcxNyAzLjgwMy4yOTQgMS4zMzYgMi4wOCA5LjE4NyAyLjYzNyAxMS42NzRsLjAwMi4wMTJjLjUyOCAyLjYzNy0xLjg3MyA0LjcyNC01LjIzNiA0LjcyNC0zLjI5IDAtNi4zNjMtMS45ODgtNi44NjItNC41MjgtLjUzLTIuNjQgMS44NzMtNC43MzQgNS4yMzMtNC43MzQuNjcyIDAgMS4zNDcuMDg1IDIuMDE0LjI1LjIyNy4wNTcuNDM2LjExOC42MzYuMTg3em0tMTYuOTk2IDUuOTljLS4wMS0uMzE4LS4wOS0uODM4LS4yNjYtMS43MzctLjA5LS40Ni0uNTk1LTIuOTM3LS43NTMtMy43MjctLjM5LTEuOTYtLjc1LTMuODktMS4xMy02LjA3LS43MzItNC4yMjMtLjY5Mi02LjA1LjM0NC02LjUyNi41MDItLjIzIDEuMDYtLjA4MiAxLjg0LjM1LjQxNS4yMjcgMi4xODIgMS4zNjQgMi4wNyAxLjI5NSAxLjk5MyAxLjI0MiAzLjQ2MiAxLjc3NCA0LjkyNiAxLjU0OCAxLjUyNS0uMjQgMi41MDQtLjA2NCAyLjg3Ni42MTQuMzQ4LjYzNS4wMTUgMS40MTUtLjcyOCAyLjE4LTEuNDc0IDEuNTE3LTMuOTc3IDIuNTEzLTUuODQ3IDIuMDE3LS44Mi0uMjItMS4yMzYtLjQ2NC0yLjM3OC0xLjI2N2wtLjA5NS0uMDY1Yy4wNDcuNTkzLjI2NCAxLjc0LjcxNyAzLjgwMi4yOTQgMS4zMzcgMi4wNzggOS4xOSAyLjYzNiAxMS42NzVsLjAwMy4wMTNjLjUxNyAyLjYzOC0xLjg4NCA0LjczMi01LjIzNCA0LjczMi0zLjI4NyAwLTYuMzYtMS45OTMtNi44Ny00LjU0LS41Mi0yLjY0IDEuODg0LTQuNzMgNS4yNC00LjczLjkwNSAwIDEuODAzLjE1IDIuNjUuNDM2eiIvPjwvZz48L3N2Zz4=",blocks:[{opcode:"playDrumForBeats",blockType:i.COMMAND,text:a({id:"music.playDrumForBeats",default:"play drum [DRUM] for [BEATS] beats",description:"play drum sample for a number of beats"}),arguments:{DRUM:{type:r.NUMBER,menu:"DRUM",defaultValue:1},BEATS:{type:r.NUMBER,defaultValue:.25}}},{opcode:"midiPlayDrumForBeats",blockType:i.COMMAND,text:a({id:"music.midiPlayDrumForBeats",default:"play drum [DRUM] for [BEATS] beats",description:"play drum sample for a number of beats according to a mapping of MIDI codes"}),arguments:{DRUM:{type:r.NUMBER,menu:"DRUM",defaultValue:1},BEATS:{type:r.NUMBER,defaultValue:.25}},hideFromPalette:!0},{opcode:"restForBeats",blockType:i.COMMAND,text:a({id:"music.restForBeats",default:"rest for [BEATS] beats",description:"rest (play no sound) for a number of beats"}),arguments:{BEATS:{type:r.NUMBER,defaultValue:.25}}},{opcode:"playNoteForBeats",blockType:i.COMMAND,text:a({id:"music.playNoteForBeats",default:"play note [NOTE] for [BEATS] beats",description:"play a note for a number of beats"}),arguments:{NOTE:{type:r.NOTE,defaultValue:60},BEATS:{type:r.NUMBER,defaultValue:.25}}},{opcode:"setInstrument",blockType:i.COMMAND,text:a({id:"music.setInstrument",default:"set instrument to [INSTRUMENT]",description:"set the instrument (e.g. piano, guitar, trombone) for notes played"}),arguments:{INSTRUMENT:{type:r.NUMBER,menu:"INSTRUMENT",defaultValue:1}}},{opcode:"midiSetInstrument",blockType:i.COMMAND,text:a({id:"music.midiSetInstrument",default:"set instrument to [INSTRUMENT]",description:"set the instrument for notes played according to a mapping of MIDI codes"}),arguments:{INSTRUMENT:{type:r.NUMBER,defaultValue:1}},hideFromPalette:!0},{opcode:"setTempo",blockType:i.COMMAND,text:a({id:"music.setTempo",default:"set tempo to [TEMPO]",description:"set tempo (speed) for notes, drums, and rests played"}),arguments:{TEMPO:{type:r.NUMBER,defaultValue:60}}},{opcode:"changeTempo",blockType:i.COMMAND,text:a({id:"music.changeTempo",default:"change tempo by [TEMPO]",description:"change tempo (speed) for notes, drums, and rests played"}),arguments:{TEMPO:{type:r.NUMBER,defaultValue:20}}},{opcode:"getTempo",text:a({id:"music.getTempo",default:"tempo",description:"get the current tempo (speed) for notes, drums, and rests played"}),blockType:i.REPORTER}],menus:{DRUM:{acceptReporters:!0,items:this._buildMenu(this.DRUM_INFO)},INSTRUMENT:{acceptReporters:!0,items:this._buildMenu(this.INSTRUMENT_INFO)}}}}_isConcurrencyLimited(){return this.runtime.runtimeOptions.miscLimits&&this._concurrencyCounter>h.CONCURRENCY_LIMIT}playDrumForBeats(t,e){this._playDrumForBeats(t.DRUM,t.BEATS,e)}midiPlayDrumForBeats(t,e){let n=o.toNumber(t.DRUM);n=Math.round(n);const r=this.MIDI_DRUMS[n-35];n=r?r[0]:2,n+=1,this._playDrumForBeats(n,t.BEATS,e)}_playDrumForBeats(t,e,n){this._stackTimerNeedsInit(n)?(t=o.toNumber(t),t=Math.round(t),t-=1,t=c.wrapClamp(t,0,this.DRUM_INFO.length-1),e=o.toNumber(e),e=this._clampBeats(e),this._playDrumNum(n,t),this._startStackTimer(n,this._beatsToSec(e))):this._checkStackTimer(n)}_playDrumNum(t,e){if(null===t.runtime.audioEngine)return;if(null===t.target.sprite.soundBank)return;if(this._isConcurrencyLimited())return;const n=this._drumPlayers[e];if(void 0===n)return;n.isPlaying&&!n.isStarting&&n.take();const r=t.runtime.audioEngine,i=r.audioContext.createGain();i.gain.setValueAtTime(t.target.volume/100,r.currentTime),i.connect(r.getInputNode()),this._concurrencyCounter++,n.once("stop",(()=>{this._concurrencyCounter--})),n.play(),n.connect({getInputNode:()=>i})}restForBeats(t,e){if(this._stackTimerNeedsInit(e)){let n=o.toNumber(t.BEATS);n=this._clampBeats(n),this._startStackTimer(e,this._beatsToSec(n))}else this._checkStackTimer(e)}playNoteForBeats(t,e){if(this._stackTimerNeedsInit(e)){let n=o.toNumber(t.NOTE);n=c.clamp(n,h.MIDI_NOTE_RANGE.min,h.MIDI_NOTE_RANGE.max);let r=o.toNumber(t.BEATS);if(r=this._clampBeats(r),0===r)return;const i=this._beatsToSec(r);this._playNote(e,n,i),this._startStackTimer(e,i)}else this._checkStackTimer(e)}_playNoteForPicker(t,e){if(e!==this.getInfo().name)return;const n={runtime:this.runtime,target:this.runtime.getEditingTarget()};this._playNote(n,t,.25)}_playNote(t,e,n){if(null===t.runtime.audioEngine)return;if(null===t.target.sprite.soundBank)return;if(this._isConcurrencyLimited())return;const r=this._getMusicState(t.target).currentInstrument,i=this.INSTRUMENT_INFO[r].samples,s=this._selectSampleIndexForNote(e,i);if(void 0===this._instrumentPlayerArrays[r])return;if(void 0===this._instrumentPlayerArrays[r][s])return;const o=t.runtime.audioEngine;this._instrumentPlayerNoteArrays[r][e]||(this._instrumentPlayerNoteArrays[r][e]=this._instrumentPlayerArrays[r][s].take());const a=this._instrumentPlayerNoteArrays[r][e];a.isPlaying&&!a.isStarting&&a.take();const c=i[s],u=this._ratioForPitchInterval(e-c),l=o.audioContext,h=l.createGain();h.gain.setValueAtTime(t.target.volume/100,o.currentTime);const d=l.createGain();h.connect(d),d.connect(o.getInputNode());let p=this.INSTRUMENT_INFO[r].releaseTime;void 0===p&&(p=.01);const f=l.currentTime+n,m=f+p;d.gain.setValueAtTime(1,f),d.gain.linearRampToValueAtTime(1e-4,m),this._concurrencyCounter++,a.once("stop",(()=>{this._concurrencyCounter--})),a.play(),a.connect({getInputNode:()=>h}),a.outputNode.playbackRate.value=u,a.outputNode.stop(m)}_selectSampleIndexForNote(t,e){for(let n=e.length-1;n>=0;n--)if(t>=e[n])return n;return 0}_ratioForPitchInterval(t){return Math.pow(2,t/12)}_clampBeats(t){return c.clamp(t,h.BEAT_RANGE.min,h.BEAT_RANGE.max)}_beatsToSec(t){return 60/this.getTempo()*t}_stackTimerNeedsInit(t){return!t.stackFrame.timer}_startStackTimer(t,e){t.stackFrame.timer=new u,t.stackFrame.timer.start(),t.stackFrame.duration=e,t.yield()}_checkStackTimer(t){t.stackFrame.timer.timeElapsed()<1e3*t.stackFrame.duration&&t.yield()}setInstrument(t,e){this._setInstrument(t.INSTRUMENT,e,!1)}midiSetInstrument(t,e){this._setInstrument(t.INSTRUMENT,e,!0)}_setInstrument(t,e,n){const r=this._getMusicState(e.target);t=o.toNumber(t),t=Math.round(t),t-=1,n&&(t=(this.MIDI_INSTRUMENTS[t]||0)-1),t=c.wrapClamp(t,0,this.INSTRUMENT_INFO.length-1),r.currentInstrument=t}setTempo(t){const e=o.toNumber(t.TEMPO);this._updateTempo(e)}changeTempo(t){const e=o.toNumber(t.TEMPO)+this.getTempo();this._updateTempo(e)}_updateTempo(t){t=c.clamp(t,h.TEMPO_RANGE.min,h.TEMPO_RANGE.max);const e=this.runtime.getTargetForStage();e&&(e.tempo=t)}getTempo(){const t=this.runtime.getTargetForStage();return t?t.tempo:60}}t.exports=h},function(t,e,n){t.exports={"drums/1-snare.mp3":n(117),"drums/2-bass-drum.mp3":n(118),"drums/3-side-stick.mp3":n(119),"drums/4-crash-cymbal.mp3":n(120),"drums/5-open-hi-hat.mp3":n(121),"drums/6-closed-hi-hat.mp3":n(122),"drums/7-tambourine.mp3":n(123),"drums/8-hand-clap.mp3":n(124),"drums/9-claves.mp3":n(125),"drums/10-wood-block.mp3":n(126),"drums/11-cowbell.mp3":n(127),"drums/12-triangle.mp3":n(128),"drums/13-bongo.mp3":n(129),"drums/14-conga.mp3":n(130),"drums/15-cabasa.mp3":n(131),"drums/16-guiro.mp3":n(132),"drums/17-vibraslap.mp3":n(133),"drums/18-cuica.mp3":n(134),"instruments/1-piano/24.mp3":n(135),"instruments/1-piano/36.mp3":n(136),"instruments/1-piano/48.mp3":n(137),"instruments/1-piano/60.mp3":n(138),"instruments/1-piano/72.mp3":n(139),"instruments/1-piano/84.mp3":n(140),"instruments/1-piano/96.mp3":n(141),"instruments/1-piano/108.mp3":n(142),"instruments/2-electric-piano/60.mp3":n(143),"instruments/3-organ/60.mp3":n(144),"instruments/4-guitar/60.mp3":n(145),"instruments/5-electric-guitar/60.mp3":n(146),"instruments/6-bass/36.mp3":n(147),"instruments/6-bass/48.mp3":n(148),"instruments/7-pizzicato/60.mp3":n(149),"instruments/8-cello/36.mp3":n(150),"instruments/8-cello/48.mp3":n(151),"instruments/8-cello/60.mp3":n(152),"instruments/9-trombone/36.mp3":n(153),"instruments/9-trombone/48.mp3":n(154),"instruments/9-trombone/60.mp3":n(155),"instruments/10-clarinet/48.mp3":n(156),"instruments/10-clarinet/60.mp3":n(157),"instruments/11-saxophone/36.mp3":n(158),"instruments/11-saxophone/60.mp3":n(159),"instruments/11-saxophone/84.mp3":n(160),"instruments/12-flute/60.mp3":n(161),"instruments/12-flute/72.mp3":n(162),"instruments/13-wooden-flute/60.mp3":n(163),"instruments/13-wooden-flute/72.mp3":n(164),"instruments/14-bassoon/36.mp3":n(165),"instruments/14-bassoon/48.mp3":n(166),"instruments/14-bassoon/60.mp3":n(167),"instruments/15-choir/48.mp3":n(168),"instruments/15-choir/60.mp3":n(169),"instruments/15-choir/72.mp3":n(170),"instruments/16-vibraphone/60.mp3":n(171),"instruments/16-vibraphone/72.mp3":n(172),"instruments/17-music-box/60.mp3":n(173),"instruments/18-steel-drum/60.mp3":n(174),"instruments/19-marimba/60.mp3":n(175),"instruments/20-synth-lead/60.mp3":n(176),"instruments/21-synth-pad/60.mp3":n(177)}},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e){t.exports=null},function(t,e,n){const r=n(3),i=n(2),s=n(0),o=n(1),a=n(5),c=n(28),u=n(14),l=129,h=130,d="micro:bit extension stopped receiving data",p=61445,f="5261da01-fa7e-42ab-850b-7c80220097cc",m="5261da02-fa7e-42ab-850b-7c80220097cc";class g{constructor(t,e){this._runtime=t,this._ble=null,this._runtime.registerPeripheralExtension(e,this),this._extensionId=e,this._sensors={tiltX:0,tiltY:0,buttonA:0,buttonB:0,touchPins:[0,0,0],gestureState:0,ledMatrixState:new Uint8Array(5)},this._gestures={moving:!1,move:{active:!1,timeout:!1},shake:{active:!1,timeout:!1},jump:{active:!1,timeout:!1}},this._timeoutID=null,this._busy=!1,this._busyTimeoutID=null,this.reset=this.reset.bind(this),this._onConnect=this._onConnect.bind(this),this._onMessage=this._onMessage.bind(this)}displayText(t){const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return this.send(l,e)}displayMatrix(t){return this.send(h,t)}get tiltX(){return this._sensors.tiltX}get tiltY(){return this._sensors.tiltY}get buttonA(){return this._sensors.buttonA}get buttonB(){return this._sensors.buttonB}get gestureState(){return this._sensors.gestureState}get ledMatrixState(){return this._sensors.ledMatrixState}scan(){this._ble&&this._ble.disconnect(),this._ble=new c(this._runtime,this._extensionId,{filters:[{services:[p]}]},this._onConnect,this.reset)}connect(t){this._ble&&this._ble.connectPeripheral(t)}disconnect(){this._ble&&this._ble.disconnect(),this.reset()}reset(){this._timeoutID&&(window.clearTimeout(this._timeoutID),this._timeoutID=null)}isConnected(){let t=!1;return this._ble&&(t=this._ble.isConnected()),t}send(t,e){if(!this.isConnected())return;if(this._busy)return;this._busy=!0,this._busyTimeoutID=window.setTimeout((()=>{this._busy=!1}),5e3);const n=new Uint8Array(e.length+1);n[0]=t;for(let t=0;t<e.length;t++)n[t+1]=e[t];const r=u.uint8ArrayToBase64(n);this._ble.write(p,m,r,"base64",!0).then((()=>{this._busy=!1,window.clearTimeout(this._busyTimeoutID)}))}_onConnect(){this._ble.read(p,f,!0,this._onMessage),this._timeoutID=window.setTimeout((()=>this._ble.handleDisconnectError(d)),4500)}_onMessage(t){const e=u.base64ToUint8Array(t);this._sensors.tiltX=e[1]|e[0]<<8,this._sensors.tiltX>32768&&(this._sensors.tiltX-=65536),this._sensors.tiltY=e[3]|e[2]<<8,this._sensors.tiltY>32768&&(this._sensors.tiltY-=65536),this._sensors.buttonA=e[4],this._sensors.buttonB=e[5],this._sensors.touchPins[0]=e[6],this._sensors.touchPins[1]=e[7],this._sensors.touchPins[2]=e[8],this._sensors.gestureState=e[9],window.clearTimeout(this._timeoutID),this._timeoutID=window.setTimeout((()=>this._ble.handleDisconnectError(d)),4500)}_checkPinState(t){return this._sensors.touchPins[t]}}const b="front",y="back",v="left",w="right",T="any",E="moved",A="shaken",k="jumped",I="A",S="B",x="any",O="on",M="off";class N{static get EXTENSION_NAME(){return"micro:bit"}static get EXTENSION_ID(){return"microbit"}static get TILT_THRESHOLD(){return 15}get BUTTONS_MENU(){return[{text:"A",value:I},{text:"B",value:S},{text:a({id:"microbit.buttonsMenu.any",default:"any",description:'label for "any" element in button picker for micro:bit extension'}),value:x}]}get GESTURES_MENU(){return[{text:a({id:"microbit.gesturesMenu.moved",default:"moved",description:"label for moved gesture in gesture picker for micro:bit extension"}),value:E},{text:a({id:"microbit.gesturesMenu.shaken",default:"shaken",description:"label for shaken gesture in gesture picker for micro:bit extension"}),value:A},{text:a({id:"microbit.gesturesMenu.jumped",default:"jumped",description:"label for jumped gesture in gesture picker for micro:bit extension"}),value:k}]}get PIN_STATE_MENU(){return[{text:a({id:"microbit.pinStateMenu.on",default:"on",description:"label for on element in pin state picker for micro:bit extension"}),value:O},{text:a({id:"microbit.pinStateMenu.off",default:"off",description:"label for off element in pin state picker for micro:bit extension"}),value:M}]}get TILT_DIRECTION_MENU(){return[{text:a({id:"microbit.tiltDirectionMenu.front",default:"front",description:"label for front element in tilt direction picker for micro:bit extension"}),value:b},{text:a({id:"microbit.tiltDirectionMenu.back",default:"back",description:"label for back element in tilt direction picker for micro:bit extension"}),value:y},{text:a({id:"microbit.tiltDirectionMenu.left",default:"left",description:"label for left element in tilt direction picker for micro:bit extension"}),value:v},{text:a({id:"microbit.tiltDirectionMenu.right",default:"right",description:"label for right element in tilt direction picker for micro:bit extension"}),value:w}]}get TILT_DIRECTION_ANY_MENU(){return[...this.TILT_DIRECTION_MENU,{text:a({id:"microbit.tiltDirectionMenu.any",default:"any",description:"label for any direction element in tilt direction picker for micro:bit extension"}),value:T}]}constructor(t){this.runtime=t,this._peripheral=new g(this.runtime,N.EXTENSION_ID)}getInfo(){return{id:N.EXTENSION_ID,name:N.EXTENSION_NAME,blockIconURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAACXBIWXMAABYlAAAWJQFJUiTwAAAKcElEQVR42u2cfXAU9RnHv7u3L3d7l9yR5PIGXO7MkQKaYiCUWqJhFGvRMk4JZXSc8aXVaSmiYlthVHQEW99FxiIdrVY6teiMdoa+ICqhIqgQAsjwMgYDOQKXl7uY17u9293b3f5x5JKYe8+FJGSfvzbP/n77e/azz+95nt9v90KoqgpN0hdSQ6AB1ABqADWAmmgANYAaQA2gJhpADeBEE2q8GPLaWzu/CslyiY4k9dOn5uijtXGd7+jWkaReVpT3Hrhv6d0awEFC07rgD+ZeYYnXprhwigUAvjj0zbjxQCLebozT7iDzK1ZUWCru2K7L//6MVC8ue45Blz8n6rlQ815QtuohOlXiEdy/AUqPa6y59Mkh6Q1345GNja6m7pHEQKNl3t0704EXat4L6fSOmOeEI1vHKzwAyNJR9MPFpRUPOu0ONm2A0xatWaTLm5WfDrzvAppA8AbiG03fC8CQNkDKZK2YrPAuRrhpifJERsuYywveJc7CqcIDMAyeLm82dEXzw39I/qjXkpr3QuW9lxfAdOABGAKPslWDnbsy7Jl8BxTeM3SqmO0gaA5U6c3jymup0YSn9JyLee67wpTfBQAQjmyF3HFqiJcRtDECjy5dAmbmcgQPvjjxl3Lx4IVjnD/5cE1zkWtyP34VBGcdKLJnLgc9cznk1kMXFdzEn8KJ4KUqqsSHvcxWDf7j1UM8UPr6/YgHhhX8xAaYaXgAIB7fBnbuSrBzV8aNgarEQ/z6/YkLcDTg9V9XlXjQtuqoU1TpcUHlvZDOfDiuyh5qPMCLrJ1bDw3EuUtx81N/BH3pjQBJQ2HMF5V6iKfeRchVm9kkMtrwxmSdobeA9daBde8GwVlBcFYofS1Jw0vaAy9HeJHQwBUPzIBvGxDc92Rmp/BowJs10wkAONfsBs8HAAAltqngOAO8HZ3o6OiMqcvLy4E1Lwc8H8C5ZndMXdLJa/qNacNLCDBw/O8nFUNWxp/64+tWAwBefe1tHKg7CgC4/9d3ori4EHv3HcDrb26PqVt2602ovvaHaGlpw+8ffSamLqXYmya8jG8mpFy6iGLkWLh4HAwG4+r6j4VBfaPpLgU8IMGO9MLqW2pYQ9aQokuR5dgXIwCC1CUcNMj3hpdvLAdSF54EYpCHooRA0Swomo2pC0kCQpIAkqTA6LmYupgxL0X7m78+aG10NXVkpIwxsAwWXncDCESHLkohfPbpbiT6ZFPPZQ9fC0e58Wi6wTDj6UbT/rQAyiERS2pW4Kc3LQDLRO8miCEAKj7d83FcTxyLJJJJ+9MCqKoq9HomMrgkSThxsgEcZ8AMpwMkSYJlKDA0DVUFiHGWRDJp/4jXwqIo4uFHnkZXdw8AYGbZFXhs3WqQJDkhkkim7E8KoMlkxKbnn8DBunrwUli3e8/+yOAA0HjmHDq7upGXm5PUoDUr7hmWRB5Zt3FYwoime+vtd/H6G9uGJIxouniSyP6H7v8FystnY80jGzIA0MihsMAKu20aTp3JzFb6WCWRuDUvHwByw8cOhw2FBVaYjNzIAba1e3Hfb9aiq7MTNStuBwAsvr4KO3d9GnmKztIS5EyxTJiVSDT7p04tipx/9MnnYc7ORlu7NzMxsK3di5AkDHgGw2DTC+uHBeGJshJJZL/fxyMQEDKbRAiCQDAoQhBDYBkKNE2j4uqrhpUBoiSBIMZfEhkN+1NeiWSqEB2rlUg69md0JRIQRHy86z8jXsqNVRLJlP0jqgNJXXgAgjbCcONmCHUvQ+44NWG2s/rtH5Mt/ciToo0wLH4JBGO6LLazRiJk2vBYy4gHHw/bWSN+LZBKEhkMjzn/CaSiKgQOvJDyFB7L7axUJWNJZDA8IhQA1boPin7KZbMSGfUYyFx9b3hXg/cCsoBA2Z0AoYOaxlcC4+mdyCUDKBzanLFBJ3USyaRMuiSSKZmUSSSTMimTCABUlblRU9kAZ0E39p+eii21c+EL0jHbOwu6sfaWgyjND//U4oP6MmzZnfi79XT7mfQSNi7bh0JzOLG19XBY/89r49pYVebGqhuOosDsh1+gsWV3BXYdd2Q+BlaVuXFv9bHgkSbzk+vfcVRyjHhi47J9cftsXLYf7T36Ix8cLHlo6ydlv6qpPI2qssRZcuOy/Wjp4k5s+2zG+offKqtcUt6kJtNv7S0H0RtkvEufXTB/6bML5je2Wy7UVDbEbF9o9mPDsv2oP5v75vbPS26rP5u3fdXiozDppcwDrKlswOlWy9E//DX09Mt/azh8zzNM1RybF86C7pheVGD240CDeX3NWtfml94Rt+0+Mf3Lm8qbEnpfgdmPs+3G9+564vTT//pM/GrHYduWRP0AYOEMN/5S61xT92Vtfd2XtfWb/vu91fHALyxzw9tnkB/cTD5w+2Ou9375HHtfa7exM5mxRpKFaafdQQKgAcDERs98/foLHrXdaXfoABi8vczhWO2/28/TRR5z2h00gKymNl1ton79oigq6bQ7dE67Q+ew9mb1h4FYYwVESgLAXLSRa+3mWpIdK+UYuPiq89f8+XfT/+ftZQ4vLm9ZmUyfdcsv1M2fWfRaUCK8i8vdK1u6ktuAWPWTsztm24o/cnnYHUsrWzd1+fVJ9XtqxbG3XzFdNcPTawjcueibpxK1t+X26f/9R8a953jub4typOvm2b1XnvUmv8JKWMZcaZffX3XDERRP8cGaFRjWxtPLoZvXY4oxgPBNEsgxBhCUKEzL6Ru+JydS8Ak0giKFgESDJFQoKmCgQzAwIfQEWETzmoBIwd2VNaStu8uEHGO4Buz06zHHFv0dRkefAZ1+PQx0KNK2eIoPLCUj2zDc275qzgcBFWv+cf3IyxgTK2KOzQufEM5kfpGF12eGPSf8DXN+No/87HDWiwYYALw+M6ym8AscAxO++X7xCTRM7EDQzht0Da8v/NWo1dQDAxNCocUXs+303IGHdaptOmYXnh/SLlZbV+fwnwJm6UXEm/ojqgM/PFmJQ81OPHfrtqT7bN23BE8seTflYLvz5DwYGQHLKz5Puo/XZ8aLtT+D1dSDuxbsGQIymmz48DbwIguOESJOcce8XaO3oVpZ8k3Em5KVVAAMFnuOB9as1MbimCBunn04vBmR40ls29Wfgxf1KMn1gBdY+MXUCvK4ANvPndpLzrLzALjBN2VPwrDBksgLYkn1jBMp90nVY2++8vAw3RlPeLNYVZSPAEgjKWP6ZCn4lF+gMdnE08spQb73RQB9aXtgo6tJcNodf8rWz3L//Br340UW3sExEkXrFFKSSUVHqkRfkJZ8QSZk5gS6hw9H+GyDQAclSs41BVmSUIn+toAKIUTJskKoQUknCxKlkISKb/sM0NMyyVAhXW+AlYosfgOgQlUJVadTSUWBKoQoudvPioPbenq5oIUTaRUqenhWKi3oyVIUqKpKREoLggDhF6hQb4CV9LRM9rctMPN6glChp2SdTqeSskwoAECSKnG61fzFR/XsGu+FhmONriYl7TImsjoYKJyZSeB8CoBQo6spqU8TCO1fgE7gDVUNoCYaQA2gBlADqAHURAOoAdQAagA10QCOgfwfNp/hXbfBMCAAAAAASUVORK5CYII=",showStatusButton:!0,blocks:[{opcode:"whenButtonPressed",text:a({id:"microbit.whenButtonPressed",default:"when [BTN] button pressed",description:"when the selected button on the micro:bit is pressed"}),blockType:i.HAT,arguments:{BTN:{type:r.STRING,menu:"buttons",defaultValue:I}}},{opcode:"isButtonPressed",text:a({id:"microbit.isButtonPressed",default:"[BTN] button pressed?",description:"is the selected button on the micro:bit pressed?"}),blockType:i.BOOLEAN,arguments:{BTN:{type:r.STRING,menu:"buttons",defaultValue:I}}},"---",{opcode:"whenGesture",text:a({id:"microbit.whenGesture",default:"when [GESTURE]",description:"when the selected gesture is detected by the micro:bit"}),blockType:i.HAT,arguments:{GESTURE:{type:r.STRING,menu:"gestures",defaultValue:E}}},"---",{opcode:"displaySymbol",text:a({id:"microbit.displaySymbol",default:"display [MATRIX]",description:"display a pattern on the micro:bit display"}),blockType:i.COMMAND,arguments:{MATRIX:{type:r.MATRIX,defaultValue:"0101010101100010101000100"}}},{opcode:"displayText",text:a({id:"microbit.displayText",default:"display text [TEXT]",description:"display text on the micro:bit display"}),blockType:i.COMMAND,arguments:{TEXT:{type:r.STRING,defaultValue:a({id:"microbit.defaultTextToDisplay",default:"Hello!",description:'default text to display.\n                                IMPORTANT - the micro:bit only supports letters a-z, A-Z.\n                                Please substitute a default word in your language\n                                that can be written with those characters,\n                                substitute non-accented characters or leave it as "Hello!".\n                                Check the micro:bit site documentation for details'})}}},{opcode:"displayClear",text:a({id:"microbit.clearDisplay",default:"clear display",description:"display nothing on the micro:bit display"}),blockType:i.COMMAND},"---",{opcode:"whenTilted",text:a({id:"microbit.whenTilted",default:"when tilted [DIRECTION]",description:"when the micro:bit is tilted in a direction"}),blockType:i.HAT,arguments:{DIRECTION:{type:r.STRING,menu:"tiltDirectionAny",defaultValue:T}}},{opcode:"isTilted",text:a({id:"microbit.isTilted",default:"tilted [DIRECTION]?",description:"is the micro:bit is tilted in a direction?"}),blockType:i.BOOLEAN,arguments:{DIRECTION:{type:r.STRING,menu:"tiltDirectionAny",defaultValue:T}}},{opcode:"getTiltAngle",text:a({id:"microbit.tiltAngle",default:"tilt angle [DIRECTION]",description:"how much the micro:bit is tilted in a direction"}),blockType:i.REPORTER,arguments:{DIRECTION:{type:r.STRING,menu:"tiltDirection",defaultValue:b}}},"---",{opcode:"whenPinConnected",text:a({id:"microbit.whenPinConnected",default:"when pin [PIN] connected",description:"when the pin detects a connection to Earth/Ground"}),blockType:i.HAT,arguments:{PIN:{type:r.STRING,menu:"touchPins",defaultValue:"0"}}}],menus:{buttons:{acceptReporters:!0,items:this.BUTTONS_MENU},gestures:{acceptReporters:!0,items:this.GESTURES_MENU},pinState:{acceptReporters:!0,items:this.PIN_STATE_MENU},tiltDirection:{acceptReporters:!0,items:this.TILT_DIRECTION_MENU},tiltDirectionAny:{acceptReporters:!0,items:this.TILT_DIRECTION_ANY_MENU},touchPins:{acceptReporters:!0,items:["0","1","2"]}}}}whenButtonPressed(t){return"any"===t.BTN?this._peripheral.buttonA|this._peripheral.buttonB:"A"===t.BTN?this._peripheral.buttonA:"B"===t.BTN&&this._peripheral.buttonB}isButtonPressed(t){return"any"===t.BTN?!!(this._peripheral.buttonA|this._peripheral.buttonB):"A"===t.BTN?0!==this._peripheral.buttonA:"B"===t.BTN&&0!==this._peripheral.buttonB}whenGesture(t){const e=o.toString(t.GESTURE);return"moved"===e?this._peripheral.gestureState>>2&1:"shaken"===e?1&this._peripheral.gestureState:"jumped"===e&&this._peripheral.gestureState>>1&1}displaySymbol(t){const e=o.toString(t.MATRIX).replace(/\s/g,"").split("").reduce(((t,e,n)=>"0"===e?t:t+Math.pow(2,n)),0);return null!==e&&(this._peripheral.ledMatrixState[0]=31&e,this._peripheral.ledMatrixState[1]=e>>5&31,this._peripheral.ledMatrixState[2]=e>>10&31,this._peripheral.ledMatrixState[3]=e>>15&31,this._peripheral.ledMatrixState[4]=e>>20&31,this._peripheral.displayMatrix(this._peripheral.ledMatrixState)),new Promise((t=>{setTimeout((()=>{t()}),100)}))}displayText(t){const e=String(t.TEXT).substring(0,19);e.length>0&&this._peripheral.displayText(e);const n=120*(6*e.length+6);return new Promise((t=>{setTimeout((()=>{t()}),n)}))}displayClear(){for(let t=0;t<5;t++)this._peripheral.ledMatrixState[t]=0;return this._peripheral.displayMatrix(this._peripheral.ledMatrixState),new Promise((t=>{setTimeout((()=>{t()}),100)}))}whenTilted(t){return this._isTilted(t.DIRECTION)}isTilted(t){return this._isTilted(t.DIRECTION)}getTiltAngle(t){return this._getTiltAngle(t.DIRECTION)}_isTilted(t){return t===T?Math.abs(this._peripheral.tiltX/10)>=N.TILT_THRESHOLD||Math.abs(this._peripheral.tiltY/10)>=N.TILT_THRESHOLD:this._getTiltAngle(t)>=N.TILT_THRESHOLD}_getTiltAngle(t){switch(t){case b:return Math.round(this._peripheral.tiltY/-10);case y:return Math.round(this._peripheral.tiltY/10);case v:return Math.round(this._peripheral.tiltX/-10);case w:return Math.round(this._peripheral.tiltX/10);default:s.warn("Unknown tilt direction in _getTiltAngle: ".concat(t))}}whenPinConnected(t){const e=parseInt(t.PIN,10);if(!isNaN(e))return!(e<0||e>2)&&this._peripheral._checkPinState(e)}}t.exports=N},function(t,e,n){const r=n(5),i=n(59),s=n(3),o=n(2),a=n(1),c=n(4),u=n(11),l=n(0),{fetchWithTimeout:h}=n(38),d="ALTO",p="TENOR",f="SQUEAK",m="GIANT",g="KITTEN",b="ar",y="zh-cn",v="da",w="nl",T="en",E="fr",A="de",k="hi",I="is",S="it",x="ja",O="ko",M="nb",N="pl",C="pt-br",R="pt",D="ro",P="ru",L="es",B="es-419",U="sv",j="tr",F="cy";class z{constructor(t){this.runtime=t,this._soundPlayers=new Map,this._stopAllSpeech=this._stopAllSpeech.bind(this),this.runtime&&this.runtime.on("PROJECT_STOP_ALL",this._stopAllSpeech),this._onTargetCreated=this._onTargetCreated.bind(this),this.runtime&&t.on("targetWasCreated",this._onTargetCreated),this._supportedLocales=this._getSupportedLocales()}get VOICE_INFO(){return{[d]:{name:r({id:"text2speech.alto",default:"alto",description:"Name for a voice with ambiguous gender."}),gender:"female",playbackRate:1},[p]:{name:r({id:"text2speech.tenor",default:"tenor",description:"Name for a voice with ambiguous gender."}),gender:"male",playbackRate:1},[f]:{name:r({id:"text2speech.squeak",default:"squeak",description:"Name for a funny voice with a high pitch."}),gender:"female",playbackRate:1.19},[m]:{name:r({id:"text2speech.giant",default:"giant",description:"Name for a funny voice with a low pitch."}),gender:"male",playbackRate:.84},[g]:{name:r({id:"text2speech.kitten",default:"kitten",description:"A baby cat."}),gender:"female",playbackRate:1.41}}}get LANGUAGE_INFO(){return{[b]:{name:"Arabic",locales:["ar"],speechSynthLocale:"arb",singleGender:!0},[y]:{name:"Chinese (Mandarin)",locales:["zh-cn","zh-tw"],speechSynthLocale:"cmn-CN",singleGender:!0},[v]:{name:"Danish",locales:["da"],speechSynthLocale:"da-DK"},[w]:{name:"Dutch",locales:["nl"],speechSynthLocale:"nl-NL"},[T]:{name:"English",locales:["en"],speechSynthLocale:"en-US"},[E]:{name:"French",locales:["fr"],speechSynthLocale:"fr-FR"},[A]:{name:"German",locales:["de"],speechSynthLocale:"de-DE"},[k]:{name:"Hindi",locales:["hi"],speechSynthLocale:"hi-IN",singleGender:!0},[I]:{name:"Icelandic",locales:["is"],speechSynthLocale:"is-IS"},[S]:{name:"Italian",locales:["it"],speechSynthLocale:"it-IT"},[x]:{name:"Japanese",locales:["ja","ja-hira"],speechSynthLocale:"ja-JP"},[O]:{name:"Korean",locales:["ko"],speechSynthLocale:"ko-KR",singleGender:!0},[M]:{name:"Norwegian",locales:["nb","nn"],speechSynthLocale:"nb-NO",singleGender:!0},[N]:{name:"Polish",locales:["pl"],speechSynthLocale:"pl-PL"},[C]:{name:"Portuguese (Brazilian)",locales:["pt-br"],speechSynthLocale:"pt-BR"},[R]:{name:"Portuguese (European)",locales:["pt"],speechSynthLocale:"pt-PT"},[D]:{name:"Romanian",locales:["ro"],speechSynthLocale:"ro-RO",singleGender:!0},[P]:{name:"Russian",locales:["ru"],speechSynthLocale:"ru-RU"},[L]:{name:"Spanish (European)",locales:["es"],speechSynthLocale:"es-ES"},[B]:{name:"Spanish (Latin American)",locales:["es-419"],speechSynthLocale:"es-US"},[U]:{name:"Swedish",locales:["sv"],speechSynthLocale:"sv-SE",singleGender:!0},[j]:{name:"Turkish",locales:["tr"],speechSynthLocale:"tr-TR",singleGender:!0},[F]:{name:"Welsh",locales:["cy"],speechSynthLocale:"cy-GB",singleGender:!0}}}static get STATE_KEY(){return"Scratch.text2speech"}static get DEFAULT_TEXT2SPEECH_STATE(){return{voiceId:d}}get DEFAULT_LANGUAGE(){return"en"}_getState(t){let e=t.getCustomState(z.STATE_KEY);return e||(e=u.simple(z.DEFAULT_TEXT2SPEECH_STATE),t.setCustomState(z.STATE_KEY,e)),e}_onTargetCreated(t,e){if(e){const n=e.getCustomState(z.STATE_KEY);n&&t.setCustomState(z.STATE_KEY,u.simple(n))}}getInfo(){let t="hello";return this.isSupportedLanguage(this.getEditorLanguage())&&(t=r({id:"text2speech.defaultTextToSpeak",default:"hello",description:"hello: the default text to speak"})),{id:"text2speech",name:r({id:"text2speech.categoryName",default:"Text to Speech",description:"Name of the Text to Speech extension."}),blockIconURI:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDAgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUyLjIgKDY3MTQ1KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5FeHRlbnNpb25zL1NvZnR3YXJlL1RleHQtdG8tU3BlZWNoLUJsb2NrPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGcgaWQ9IkV4dGVuc2lvbnMvU29mdHdhcmUvVGV4dC10by1TcGVlY2gtQmxvY2siIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZS1vcGFjaXR5PSIwLjE1Ij4KICAgICAgICA8ZyBpZD0idGV4dDJzcGVlY2giIHRyYW5zZm9ybT0idHJhbnNsYXRlKDQuMDAwMDAwLCA0LjAwMDAwMCkiIGZpbGwtcnVsZT0ibm9uemVybyIgc3Ryb2tlPSIjMDAwMDAwIj4KICAgICAgICAgICAgPHBhdGggZD0iTTExLjUsMTcuNjY5MzQzNSBDMTEuNSwxNi42NTM5MjY5IDEwLjAwNjAxNDUsMTYuMDg0NDI3NCA5LjExMjU2MDI0LDE2Ljg4ODMgTDYuNDEyNTYwMjQsMTkuMDUwNzE0IEM1LjM5MzQ2NzU1LDE5Ljg2Njg5OTQgNC4wNzQ5NzM1MSwyMC4zMzE3NTc1IDIuNywyMC4zMzE3NTc1IEwyLjMsMjAuMzMxNzU3NSBDMS4yNjUxOTIzMywyMC4zMzE3NTc1IDAuNSwyMS4wMjEyMDAzIDAuNSwyMS45MDQwNzEgTDAuNSwyNi4xMzg3OTg2IEMwLjUsMjcuMDIxNjY5MyAxLjI2NTE5MjMzLDI3LjcxMTExMiAyLjMsMjcuNzExMTEyIEwyLjcsMjcuNzExMTEyIEM0LjE1NzU1NjgyLDI3LjcxMTExMiA1LjQ1MzcyMzIyLDI4LjEzMzUyNzEgNi41MTk3MjA5OCwyOC45OTggTDkuMTE4NDAyOTMsMzEuMTU5MzIxNiBDMTAuMDI2MTg1NSwzMS45MDkwNzkzIDExLjUsMzEuMzQ3MjY4OSAxMS41LDMwLjI4MzQyNTUgTDExLjUsMTcuNjY5MzQzNSBaIiBpZD0ic3BlYWtlciIgZmlsbD0iIzRENEQ0RCI+PC9wYXRoPgogICAgICAgICAgICA8cGF0aCBkPSJNMjEuNjQzNjA2NiwxNi41IEMxOS45NzcwMDk5LDE4LjQzNzAyMzQgMTcuMTA1MDI3NSwxOS45Mjg1NzE0IDE1LjY2NjY2NjcsMTkuOTI4NTcxNCBDMTUuNTEyNjM5NywxOS45Mjg1NzE0IDE1LjMxNjYyOTIsMTkuODk1OTAzIDE1LjEwOTcyNjUsMTkuNzkyNDUxNyBDMTQuNzM3NjAzOSwxOS42MDYzOTA0IDE0LjUsMTkuMjQ5OTg0NiAxNC41LDE4Ljc2MTkwNDggQzE0LjUsMTguNjU2ODA0MSAxNC41MTcwNTU1LDE4LjU1NDUwNzYgMTQuNTQ5NDQ2NywxOC40NTQwODQ0IEMxNC42MjU3NTQ1LDE4LjIxNzUwNjMgMTUuMTczNTcyMSwxNy40Njc1MzEgMTUuMjc3MjA3MSwxNy4yODA5ODgxIEMxNS41NDYzNTI2LDE2Ljc5NjUyNjEgMTUuNzM5MDI1LDE2LjIwNjM1NjEgMTUuODQzMjg5MSwxNS40MTYwMDM0IEMxMy4xODk3MDA1LDEzLjkyNjgzNjkgMTEuNSwxMS4xMTM5NjY4IDExLjUsOCBDMTEuNSwzLjMwNTU3OTYzIDE1LjMwNTU3OTYsLTAuNSAyMCwtMC41IEwyNCwtMC41IEMyOC42OTQ0MjA0LC0wLjUgMzIuNSwzLjMwNTU3OTYzIDMyLjUsOCBDMzIuNSwxMi42OTQ0MjA0IDI4LjY5NDQyMDQsMTYuNSAyNCwxNi41IEwyMS42NDM2MDY2LDE2LjUgWiIgaWQ9InNwZWVjaCIgZmlsbD0iI0ZGRkZGRiI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",menuIconURI:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUyLjIgKDY3MTQ1KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5FeHRlbnNpb25zL1NvZnR3YXJlL1RleHQtdG8tU3BlZWNoLU1lbnU8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZyBpZD0iRXh0ZW5zaW9ucy9Tb2Z0d2FyZS9UZXh0LXRvLVNwZWVjaC1NZW51IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0idGV4dDJzcGVlY2giIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIuMDAwMDAwLCAyLjAwMDAwMCkiIGZpbGwtcnVsZT0ibm9uemVybyI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik01Ljc1LDguODM0NjcxNzMgQzUuNzUsOC4zMjY5NjM0NCA1LjAwMzAwNzI3LDguMDQyMjEzNzEgNC41NTYyODAxMiw4LjQ0NDE0OTk5IEwzLjIwNjI4MDEyLDkuNTI1MzU3MDIgQzIuNjk2NzMzNzgsOS45MzM0NDk2OCAyLjAzNzQ4Njc1LDEwLjE2NTg3ODggMS4zNSwxMC4xNjU4Nzg4IEwxLjE1LDEwLjE2NTg3ODggQzAuNjMyNTk2MTY1LDEwLjE2NTg3ODggMC4yNSwxMC41MTA2MDAyIDAuMjUsMTAuOTUyMDM1NSBMMC4yNSwxMy4wNjkzOTkzIEMwLjI1LDEzLjUxMDgzNDYgMC42MzI1OTYxNjUsMTMuODU1NTU2IDEuMTUsMTMuODU1NTU2IEwxLjM1LDEzLjg1NTU1NiBDMi4wNzg3Nzg0MSwxMy44NTU1NTYgMi43MjY4NjE2MSwxNC4wNjY3NjM2IDMuMjU5ODYwNDksMTQuNDk5IEw0LjU1OTIwMTQ3LDE1LjU3OTY2MDggQzUuMDEzMDkyNzYsMTUuOTU0NTM5NiA1Ljc1LDE1LjY3MzYzNDQgNS43NSwxNS4xNDE3MTI4IEw1Ljc1LDguODM0NjcxNzMgWiIgaWQ9InNwZWFrZXIiIHN0cm9rZS1vcGFjaXR5PSIwLjE1IiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS13aWR0aD0iMC41IiBmaWxsPSIjNEQ0RDREIj48L3BhdGg+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMC43MDQ4MzEzLDggQzkuNzkwNjc0NjgsOS4xMzExNDg0NyA4LjMwNjYxODQsOS43MTQyODU3MSA3LjgzMzMzMzMzLDkuNzE0Mjg1NzEgQzcuODMzMzMzMzMsOS43MTQyODU3MSA3LjUsOS43MTQyODU3MSA3LjUsOS4zODA5NTIzOCBDNy41LDkuMDg1MjI2ODQgOC4wNjIyMDE2OCw4LjkwMTk0MTY0IDguMTg5MDYwNjcsNy41Njc1NDA1OCBDNi44ODk5Njk5MSw2LjkwNjc5MDA1IDYsNS41NTczMjY4MyA2LDQgQzYsMS43OTA4NjEgNy43OTA4NjEsNC4wNTgxMjI1MWUtMTYgMTAsMCBMMTIsMCBDMTQuMjA5MTM5LC00LjA1ODEyMjUxZS0xNiAxNiwxLjc5MDg2MSAxNiw0IEMxNiw2LjIwOTEzOSAxNC4yMDkxMzksOCAxMiw4IEwxMC43MDQ4MzEzLDggWiIgaWQ9InNwZWVjaCIgZmlsbD0iIzBFQkQ4QyI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",blocks:[{opcode:"speakAndWait",text:r({id:"text2speech.speakAndWaitBlock",default:"speak [WORDS]",description:"Speak some words."}),blockType:o.COMMAND,arguments:{WORDS:{type:s.STRING,defaultValue:t}}},{opcode:"setVoice",text:r({id:"text2speech.setVoiceBlock",default:"set voice to [VOICE]",description:"Set the voice for speech synthesis."}),blockType:o.COMMAND,arguments:{VOICE:{type:s.STRING,menu:"voices",defaultValue:d}}},{opcode:"setLanguage",text:r({id:"text2speech.setLanguageBlock",default:"set language to [LANGUAGE]",description:"Set the language for speech synthesis."}),blockType:o.COMMAND,arguments:{LANGUAGE:{type:s.STRING,menu:"languages",defaultValue:this.getCurrentLanguage()}}}],menus:{voices:{acceptReporters:!0,items:this.getVoiceMenu()},languages:{acceptReporters:!0,items:this.getLanguageMenu()}}}}getEditorLanguage(){return(r.setup().locale||navigator.language||navigator.userLanguage||this.DEFAULT_LANGUAGE).toLowerCase()}getCurrentLanguage(){const t=this.runtime.getTargetForStage();return t?(t.textToSpeechLanguage||this.setCurrentLanguage(this.getEditorLanguage()),t.textToSpeechLanguage):this.DEFAULT_LANGUAGE}setCurrentLanguage(t){const e=this.runtime.getTargetForStage();if(!e)return;this.isSupportedLanguage(t)&&(e.textToSpeechLanguage=this._getExtensionLocaleForSupportedLocale(t));const n=i.nameMap[t.toLowerCase()];n&&this.isSupportedLanguage(n)&&(e.textToSpeechLanguage=this._getExtensionLocaleForSupportedLocale(n)),e.textToSpeechLanguage||(e.textToSpeechLanguage=this.DEFAULT_LANGUAGE)}_getExtensionLocaleForSupportedLocale(t){for(const e in this.LANGUAGE_INFO)if(this.LANGUAGE_INFO[e].locales.includes(t))return e;l.error("cannot find extension locale for locale ".concat(t))}_getSpeechSynthLocale(){let t=this.LANGUAGE_INFO[this.DEFAULT_LANGUAGE].speechSynthLocale;return this.LANGUAGE_INFO[this.getCurrentLanguage()]&&(t=this.LANGUAGE_INFO[this.getCurrentLanguage()].speechSynthLocale),t}_getSupportedLocales(){return Object.keys(this.LANGUAGE_INFO).reduce(((t,e)=>t.concat(this.LANGUAGE_INFO[e].locales)),[])}isSupportedLanguage(t){return this._supportedLocales.includes(t)}getVoiceMenu(){return Object.keys(this.VOICE_INFO).map((t=>({text:this.VOICE_INFO[t].name,value:t})))}getLanguageMenu(){const t=this.getEditorLanguage(),e={};let n=i.menuMap[t];if(n){let r=[];i.spokenLanguages&&(r=i.spokenLanguages[t],n=n.concat(r)),n.forEach((t=>{e[t.code]=t.name}))}return Object.keys(this.LANGUAGE_INFO).map((t=>{let n=this.LANGUAGE_INFO[t].name;const r=e[t];return r&&(n=r),n=n.charAt(0).toUpperCase()+n.slice(1),{text:n,value:t}}))}setVoice(t,e){const n=this._getState(e.target);let r=t.VOICE,i=parseInt(r,10);isNaN(i)||(i-=1,i=c.wrapClamp(i,0,Object.keys(this.VOICE_INFO).length-1),r=Object.keys(this.VOICE_INFO)[i]),Object.keys(this.VOICE_INFO).includes(r)&&(n.voiceId=r)}setLanguage(t){this.setCurrentLanguage(t.LANGUAGE)}_stopAllSpeech(){this._soundPlayers.forEach((t=>{t.stop()}))}speakAndWait(t,e){let n=a.toString(t.WORDS),r=this._getSpeechSynthLocale();const i=this._getState(e.target);let s=this.VOICE_INFO[i.voiceId].gender,o=this.VOICE_INFO[i.voiceId].playbackRate;this.LANGUAGE_INFO[this.getCurrentLanguage()].singleGender&&(s="female",i.voiceId===p&&(o=.89),i.voiceId===m&&(o=.79)),i.voiceId===g&&(n=n.replace(/\S+/g,"meow"),r=this.LANGUAGE_INFO[this.DEFAULT_LANGUAGE].speechSynthLocale);let c="".concat("https://synthesis-service.scratch.mit.edu","/synth");return c+="?locale=".concat(r),c+="&gender=".concat(s),c+="&text=".concat(encodeURIComponent(n.substring(0,128))),h(c,{},1e4).then((t=>{if(200!==t.status)throw new Error("HTTP ".concat(t.status," error reaching translation service"));return t.arrayBuffer()})).then((t=>{const e={data:{buffer:t}};return this.runtime.audioEngine.decodeSoundPlayer(e)})).then((t=>{this._soundPlayers.set(t.id,t),t.setPlaybackRate(o);const e=this.runtime.audioEngine.createEffectChain();return e.set("volume",250),t.connect(e),t.play(),new Promise((e=>{t.on("stop",(()=>{this._soundPlayers.delete(t.id),e()}))}))})).catch((t=>{l.warn(t)}))}}t.exports=z},function(t,e,n){const r=n(3),i=n(2),s=n(1),o=n(0),{fetchWithTimeout:a}=n(38),c=n(59),u=n(5);t.exports=class{constructor(){this._viewerLanguageCode=this.getViewerLanguageCode(),this._supportedLanguages=[],this._randomLanguageCode="en",this._translateResult="",this._lastLangTranslated="",this._lastTextTranslated=""}static get STATE_KEY(){return"Scratch.translate"}getInfo(){return this._supportedLanguages=this._getSupportedLanguages(this.getViewerLanguageCode()),this._randomLanguageCode=this._supportedLanguages[Math.floor(Math.random()*this._supportedLanguages.length)].value,{id:"translate",name:u({id:"translate.categoryName",default:"Translate",description:"Name of extension that adds translate blocks"}),blockIconURI:"data:image/png;base64, ",menuIconURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAABYlAAAWJQFJUiTwAAAGAklEQVRYhe1YbUxTVxh+rh02o0KtkOEgKA4U4yeRWCdgxDoxCnH6h22iqSz76aasZlnijzkTBlvS4TJ/LGaJsmiyESe4hAVJvMJGxwQhLKECcRWkpWNZERs6Ctb2Lm97C/fe3n6Jyfzhk5y09z3nPPe57znnPe85DMdxeJ6x6LlW90LgM8BLchR1dXUZeXl5b3Ect+ppXsEwzHBfX98PVVVVY0GbmjW2AdgpaFYP4JxTZ+iLyCVdJFeuXNmdn59fn56enrFkyRIsWhSfk30+H1wuF+x2+1hPT4++oqLiJi/wEoA8AJslXSqdOsOlmARWV1dnlpeXd2ZnZ2fEK0xOqMViGWtoaNh++vRpa9CuZo1ZAJokQlc5dYYROR6RCq1WW56WlhZV3H0H8O9sZIHEQVzEKbTzQooBPBCYz4TlET4oFIosGtZoOHUN+Ph61GYgLuIU2tSscSmAYwAeCcx6NWs8o2aNxVKOkEUi9R55qv428Ng7b3viA/6eAs7dmrctVgD6bYBKGZ6LB4mrk7F/whcmokApfh8BWu6G2mc8ADsktuWmAbtzozGiLUJdu9QQVSC98JUkYNgBfPsboH4Z+GhPoK62FZiaAU7sCrTZmB5VHM3BPjVrrARwUVL1B4CD0vYxLVV68YFNQIICcLrn7SROtTjwEbGIE4iksFIpEVfs1BkeSdvGFUsObAz8Gm8CNTcC/49q42EIEbkLwKfhxCGWIRZC/zrQ/ifgcAWMK5YB+zc8nUBeZFuUORmfQIp/PsHGM/04YMta5oPT6cTs7Cw8Ho+oj9vtzmloaCgPZQtApVI96ejo6K2trR3lOM4nrRftJCzLfq3T6Y7LCfvuNtDL7wepfKgkTz6ZdeHdzePYlq30xz2lUintHhH0UbQ12my2+oKCguMcx7mE7aOHmWHgsxvzzzQP3ysMxMfzt2bxKmNHyZblSE5OjktYEImJidBoNFCr1frOzs5khmHe4Thubp8SCVQoFBwNUUJCwpyNwsfyZGBDOvB2fuCZQAH56KYJKJUpTy1OCOJYvXr1ocbGxjIAPwarRKvYZrNdn5iYEHV8LRW4cBj4oHheXBDT09PPRFwQxKXRaIQpmVjgkSNHfrFardcmJydjIqSMRehtOfzjmMTZmm/8hf5HAnF5vV7RVicSyHGcR6vVHh4YGPjKYrFMkTelq5JAH0B1MzMzUT+iu6cfdwfv+wv9jxchgZomaEFBwcmcnJxVY2NjXQqFQlQ/Pj6O/v7+s2az+U2Hw9Ec7X3tHXfm/v/c2hG3wLCruLm5+VBGRoY2mJGQJ0nc4ODgqZKSkjqKWSzL7olEPjJqx4PRv5CaqvE/OxyTflvWitj3xbBbnUql2kRxjYTRcA4MDHR1d3frguJiIW//NeC9/SVF2LplvcgWK8J6sKWl5UuVSrXO4/HYHj58+FNZWVkLx3HT8Rz0u3vN/t8Ho3aRaH3FgYULrKmpodT8jeBzvDcQ3T1m/5D6RXX0zNmn3TP+uq356xcmkE/NTwLoc+oMTXGpA3CnN7Bi99Hw5s8PL4mlulgFys5BXlwbn4I3qlnjsXgFBr22f+8OrFub7S/79u4Q1cWCEA8KxAmPhRfVrBFy51cK1nJnj+/rvwix0eqVswu5pJDzoPTMKhSZJzQolUoLZSLPCsRFnEI6OYE7I7xPdGYoKiq6YLVaByllWiiIg7iIM5rAYBouBB2yq5w6g+iATWGnqampZGhoqItiJSUP4YrcR9CQUh31JQ7iIk5hm7AXmPxdip5/dNIUCnduYBgm8fLly9tzc3NLwzlSqVTuW7NmzVphQkubwL179+xdXV3HKisrTVJxiJKwnuGHVM2XNjVrPCh3h8IT3+SLLKqrq+tKS0uvrly5UksJKvjsJSkpKd3r9TrkxCGSBxHwIoWXc7zAIOiIOOLUGULOsNHAMIzSZDJ9npmZeSIlJcWfTdPQm0ym8zqd7n257hGPnXxYyePv8py8mVb40ji1+UGZUmFh4Yetra1bzGbzteHh4SlKQNxu961wff7XS3Sau/w0c4VLQF7c8i8IAP4DcHKth/4Ur7MAAAAASUVORK5CYII=",blocks:[{opcode:"getTranslate",text:u({id:"translate.translateBlock",default:"translate [WORDS] to [LANGUAGE]",description:"translate some text to a different language"}),blockType:i.REPORTER,arguments:{WORDS:{type:r.STRING,defaultValue:u({id:"translate.defaultTextToTranslate",default:"hello",description:"hello: the default text to translate"})},LANGUAGE:{type:r.STRING,menu:"languages",defaultValue:this._randomLanguageCode}}},{opcode:"getViewerLanguage",text:u({id:"translate.viewerLanguage",default:"language",description:"the languge of the project viewer"}),blockType:i.REPORTER,arguments:{}}],menus:{languages:{acceptReporters:!0,items:this._supportedLanguages}}}}_getSupportedLanguages(t){return c.menuMap[t].map((t=>({text:t.name,value:t.code})))}getViewerLanguage(){this._viewerLanguageCode=this.getViewerLanguageCode();const t=c.menuMap[this._viewerLanguageCode];let e=t.find((t=>t.code===this._viewerLanguageCode));if(!e&&c.scratchToGoogleMap[this._viewerLanguageCode]){const n=c.scratchToGoogleMap[this._viewerLanguageCode];e=t.find((t=>t.code===n))}let n=this._viewerLanguageCode;return e&&(n=e.name),n}getViewerLanguageCode(){const t=[u.setup().locale].concat(navigator.languages),e=Object.keys(c.menuMap);return(t.reduce(((t,n)=>t||(e.indexOf(n.toLowerCase())>-1?n:t)),"")||"en").toLowerCase()}getLanguageCodeFromArg(t){const e=s.toString(t).toLowerCase();return Object.prototype.hasOwnProperty.call(c.menuMap,e)?e:Object.prototype.hasOwnProperty.call(c.nameMap,e)?c.nameMap[e]:-1!==c.previouslySupported.indexOf(e)?e:"en"}getTranslate(t){if(/^\d+$/.test(t.WORDS))return Promise.resolve(t.WORDS);if(this._lastTextTranslated===t.WORDS&&this._lastLangTranslated===t.LANGUAGE)return this._translateResult;const e=this.getLanguageCodeFromArg(t.LANGUAGE);let n="".concat("https://trampoline.turbowarp.org/translate/","translate?language=");n+=e,n+="&text=",n+=encodeURIComponent(t.WORDS);const r=this;return a(n,{},1e4).then((t=>t.text())).then((e=>{const n=JSON.parse(e).result;return r._translateResult=n,r._lastTextTranslated=t.WORDS,r._lastLangTranslated=t.LANGUAGE,n})).catch((e=>(o.warn("error fetching translate result! ".concat(e)),t.WORDS)))}}},function(t,e,n){const r=n(39),i=n(3),s=n(2),o=n(11),a=n(1),c=n(5),u=n(69),l=n(212),h={MOTION:"motion",DIRECTION:"direction"},d={STAGE:"Stage",SPRITE:"this sprite"},p={OFF:"off",ON:"on",ON_FLIPPED:"on-flipped"};class f{constructor(t){this.runtime=t,this.detect=new l,this._lastUpdate=null,this.firstInstall=!0,this.runtime.ioDevices&&(this.runtime.on(r.PROJECT_LOADED,this.updateVideoDisplay.bind(this)),this.runtime.on(r.PROJECT_RUN_START,this.reset.bind(this)),this._loop())}static get INTERVAL(){return 33}static get DIMENSIONS(){return[480,360]}static get STATE_KEY(){return"Scratch.videoSensing"}static get DEFAULT_MOTION_STATE(){return{motionFrameNumber:0,motionAmount:0,motionDirection:0}}get globalVideoTransparency(){const t=this.runtime.getTargetForStage();return t?t.videoTransparency:50}set globalVideoTransparency(t){const e=this.runtime.getTargetForStage();e&&(e.videoTransparency=t)}get globalVideoState(){const t=this.runtime.getTargetForStage();return t?t.videoState:p.OFF}set globalVideoState(t){const e=this.runtime.getTargetForStage();e&&(e.videoState=t)}updateVideoDisplay(){this.setVideoTransparency({TRANSPARENCY:this.globalVideoTransparency}),this.videoToggle({VIDEO_STATE:this.globalVideoState})}reset(){this.detect.reset();const t=this.runtime.targets;for(let e=0;e<t.length;e++){const n=t[e].getCustomState(f.STATE_KEY);n&&(n.motionAmount=0,n.motionDirection=0)}}_loop(){const t=Math.max(this.runtime.currentStepTime,f.INTERVAL);this._loopInterval=setTimeout(this._loop.bind(this),t);const e=Date.now();null===this._lastUpdate&&(this._lastUpdate=e);if(e-this._lastUpdate>f.INTERVAL){const t=this.runtime.ioDevices.video.getFrame({format:u.FORMAT_IMAGE_DATA,dimensions:f.DIMENSIONS});t&&(this._lastUpdate=e,this.detect.addFrame(t.data))}}_stopLoop(){clearTimeout(this._loopInterval)}_buildMenu(t){return t.map(((t,e)=>{const n={};return n.text=t.name,n.value=t.value||String(e+1),n}))}_getMotionState(t){let e=t.getCustomState(f.STATE_KEY);return e||(e=o.simple(f.DEFAULT_MOTION_STATE),t.setCustomState(f.STATE_KEY,e)),e}static get SensingAttribute(){return h}get ATTRIBUTE_INFO(){return[{name:c({id:"videoSensing.motion",default:"motion",description:'Attribute for the "video [ATTRIBUTE] on [SUBJECT]" block'}),value:h.MOTION},{name:c({id:"videoSensing.direction",default:"direction",description:'Attribute for the "video [ATTRIBUTE] on [SUBJECT]" block'}),value:h.DIRECTION}]}static get SensingSubject(){return d}get SUBJECT_INFO(){return[{name:c({id:"videoSensing.sprite",default:"sprite",description:'Subject for the "video [ATTRIBUTE] on [SUBJECT]" block'}),value:d.SPRITE},{name:c({id:"videoSensing.stage",default:"stage",description:'Subject for the "video [ATTRIBUTE] on [SUBJECT]" block'}),value:d.STAGE}]}static get VideoState(){return p}get VIDEO_STATE_INFO(){return[{name:c({id:"videoSensing.off",default:"off",description:'Option for the "turn video [STATE]" block'}),value:p.OFF},{name:c({id:"videoSensing.on",default:"on",description:'Option for the "turn video [STATE]" block'}),value:p.ON},{name:c({id:"videoSensing.onFlipped",default:"on flipped",description:'Option for the "turn video [STATE]" block that causes the video to be flipped horizontally (reversed as in a mirror)'}),value:p.ON_FLIPPED}]}getInfo(){return this.firstInstall&&(this.globalVideoState=p.ON,this.globalVideoTransparency=50,this.updateVideoDisplay(),this.firstInstall=!1),{id:"videoSensing",name:c({id:"videoSensing.categoryName",default:"Video Sensing",description:"Label for the video sensing extension category"}),blockIconURI:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDAgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUyLjIgKDY3MTQ1KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5FeHRlbnNpb25zL1NvZnR3YXJlL1ZpZGVvLVNlbnNpbmctQmxvY2s8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZyBpZD0iRXh0ZW5zaW9ucy9Tb2Z0d2FyZS9WaWRlby1TZW5zaW5nLUJsb2NrIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiBzdHJva2Utb3BhY2l0eT0iMC4xNSI+CiAgICAgICAgPGcgaWQ9InZpZGVvLW1vdGlvbiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMC4wMDAwMDAsIDEwLjAwMDAwMCkiIGZpbGwtcnVsZT0ibm9uemVybyIgc3Ryb2tlPSIjMDAwMDAwIj4KICAgICAgICAgICAgPGNpcmNsZSBpZD0iT3ZhbC1Db3B5IiBmaWxsPSIjRkZGRkZGIiBvcGFjaXR5PSIwLjI1IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGN4PSIzMiIgY3k9IjE2IiByPSI0LjUiPjwvY2lyY2xlPgogICAgICAgICAgICA8Y2lyY2xlIGlkPSJPdmFsLUNvcHkiIGZpbGw9IiNGRkZGRkYiIG9wYWNpdHk9IjAuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjeD0iMzIiIGN5PSIxMiIgcj0iNC41Ij48L2NpcmNsZT4KICAgICAgICAgICAgPGNpcmNsZSBpZD0iT3ZhbC1Db3B5IiBmaWxsPSIjRkZGRkZGIiBvcGFjaXR5PSIwLjc1IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGN4PSIzMiIgY3k9IjgiIHI9IjQuNSI+PC9jaXJjbGU+CiAgICAgICAgICAgIDxjaXJjbGUgaWQ9Ik92YWwiIGZpbGw9IiNGRkZGRkYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgY3g9IjMyIiBjeT0iNCIgcj0iNC41Ij48L2NpcmNsZT4KICAgICAgICAgICAgPHBhdGggZD0iTTIyLjY3MTk0NzcsNC40MTk1NzY0OSBMMTYuNSw4LjQxOTkxMjk4IEwxNi41LDYuMSBDMTYuNSw0LjA4OTc2NDU0IDE0LjkzNzE4MDYsMi41IDEzLDIuNSBMNC4xLDIuNSBDMi4wNzYxNDIzNywyLjUgMC41LDQuMDc2MTQyMzcgMC41LDYuMSBMMC41LDE0IEMwLjUsMTUuOTI3Mzk4NyAyLjA4NDQ5ODM5LDE3LjUxMTg5NzEgNC4xLDE3LjYgTDEzLDE3LjYgQzE0LjkwMTY2MDIsMTcuNiAxNi41LDE1Ljk0NjU0NSAxNi41LDE0IEwxNi41LDExLjcxNjkwNDggTDIyLjc1NzI0NzksMTUuNDcxMjUzNSBMMjIuODUzNTUzNCwxNS41NDY0NDY2IEMyMi44NzM3ODg2LDE1LjU2NjY4MTggMjIuOTUxNTMxLDE1LjYgMjMsMTUuNiBDMjMuMjY2OTg2NSwxNS42IDIzLjUsMTUuMzgyNTIwNyAyMy41LDE1LjEgTDIzLjUsNC44IEMyMy41LDQuODM2NzY1MzggMjMuNDQzODA1OCw0LjcwNTY0NTYzIDIzLjM3MTI1MzUsNC41NTcyNDc4OCBDMjMuMjI1OTA1Niw0LjMxNTAwMTM5IDIyLjk0MTU5MzcsNC4yNTgxMzg5OSAyMi42NzE5NDc3LDQuNDE5NTc2NDkgWiIgaWQ9InZpZGVvXzM3XyIgZmlsbD0iIzRENEQ0RCI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",menuIconURI:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUyLjIgKDY3MTQ1KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5FeHRlbnNpb25zL1NvZnR3YXJlL1ZpZGVvLVNlbnNpbmctTWVudTwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxnIGlkPSJFeHRlbnNpb25zL1NvZnR3YXJlL1ZpZGVvLVNlbnNpbmctTWVudSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9InZpZGVvLW1vdGlvbiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMC4wMDAwMDAsIDUuMDAwMDAwKSIgZmlsbC1ydWxlPSJub256ZXJvIj4KICAgICAgICAgICAgPGNpcmNsZSBpZD0iT3ZhbC1Db3B5IiBmaWxsPSIjMEVCRDhDIiBvcGFjaXR5PSIwLjI1IiBjeD0iMTYiIGN5PSI4IiByPSIyIj48L2NpcmNsZT4KICAgICAgICAgICAgPGNpcmNsZSBpZD0iT3ZhbC1Db3B5IiBmaWxsPSIjMEVCRDhDIiBvcGFjaXR5PSIwLjUiIGN4PSIxNiIgY3k9IjYiIHI9IjIiPjwvY2lyY2xlPgogICAgICAgICAgICA8Y2lyY2xlIGlkPSJPdmFsLUNvcHkiIGZpbGw9IiMwRUJEOEMiIG9wYWNpdHk9IjAuNzUiIGN4PSIxNiIgY3k9IjQiIHI9IjIiPjwvY2lyY2xlPgogICAgICAgICAgICA8Y2lyY2xlIGlkPSJPdmFsIiBmaWxsPSIjMEVCRDhDIiBjeD0iMTYiIGN5PSIyIiByPSIyIj48L2NpcmNsZT4KICAgICAgICAgICAgPHBhdGggZD0iTTExLjMzNTk3MzksMi4yMDk3ODgyNSBMOC4yNSw0LjIwOTk1NjQ5IEw4LjI1LDMuMDUgQzguMjUsMi4wNDQ4ODIyNyA3LjQ2ODU5MDMxLDEuMjUgNi41LDEuMjUgTDIuMDUsMS4yNSBDMS4wMzgwNzExOSwxLjI1IDAuMjUsMi4wMzgwNzExOSAwLjI1LDMuMDUgTDAuMjUsNyBDMC4yNSw3Ljk2MzY5OTM3IDEuMDQyMjQ5MTksOC43NTU5NDg1NiAyLjA1LDguOCBMNi41LDguOCBDNy40NTA4MzAwOSw4LjggOC4yNSw3Ljk3MzI3MjUgOC4yNSw3IEw4LjI1LDUuODU4NDUyNDEgTDguNjI4NjIzOTQsNi4wODU2MjY3NyBMMTEuNDI2Nzc2Nyw3Ljc3MzIyMzMgQzExLjQzNjg5NDMsNy43ODMzNDA5MSAxMS40NzU3NjU1LDcuOCAxMS41LDcuOCBDMTEuNjMzNDkzMiw3LjggMTEuNzUsNy42OTEyNjAzNCAxMS43NSw3LjU1IEwxMS43NSwyLjQgQzExLjc1LDIuNDE4MzgyNjkgMTEuNzIxOTAyOSwyLjM1MjgyMjgyIDExLjY4NTYyNjgsMi4yNzg2MjM5NCBDMTEuNjEyOTUyOCwyLjE1NzUwMDY5IDExLjQ3MDc5NjgsMi4xMjkwNjk1IDExLjMzNTk3MzksMi4yMDk3ODgyNSBaIiBpZD0idmlkZW9fMzdfIiBzdHJva2Utb3BhY2l0eT0iMC4xNSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjAuNSIgZmlsbD0iIzRENEQ0RCI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",blocks:[{opcode:"whenMotionGreaterThan",text:c({id:"videoSensing.whenMotionGreaterThan",default:"when video motion > [REFERENCE]",description:"Event that triggers when the amount of motion is greater than [REFERENCE]"}),blockType:s.HAT,arguments:{REFERENCE:{type:i.NUMBER,defaultValue:10}}},{opcode:"videoOn",blockType:s.REPORTER,text:c({id:"videoSensing.videoOn",default:"video [ATTRIBUTE] on [SUBJECT]",description:"Reporter that returns the amount of [ATTRIBUTE] for the selected [SUBJECT]"}),arguments:{ATTRIBUTE:{type:i.NUMBER,menu:"ATTRIBUTE",defaultValue:h.MOTION},SUBJECT:{type:i.NUMBER,menu:"SUBJECT",defaultValue:d.SPRITE}}},{opcode:"videoToggle",text:c({id:"videoSensing.videoToggle",default:"turn video [VIDEO_STATE]",description:"Controls display of the video preview layer"}),arguments:{VIDEO_STATE:{type:i.NUMBER,menu:"VIDEO_STATE",defaultValue:p.ON}}},{opcode:"setVideoTransparency",text:c({id:"videoSensing.setVideoTransparency",default:"set video transparency to [TRANSPARENCY]",description:"Controls transparency of the video preview layer"}),arguments:{TRANSPARENCY:{type:i.NUMBER,defaultValue:50}}}],menus:{ATTRIBUTE:{acceptReporters:!0,items:this._buildMenu(this.ATTRIBUTE_INFO)},SUBJECT:{acceptReporters:!0,items:this._buildMenu(this.SUBJECT_INFO)},VIDEO_STATE:{acceptReporters:!0,items:this._buildMenu(this.VIDEO_STATE_INFO)}}}}_analyzeLocalMotion(t){const e=this.runtime.renderer._allDrawables[t.drawableID],n=this._getMotionState(t);return this.detect.getLocalMotion(e,n),n}videoOn(t,e){this.detect.analyzeFrame();let n=this.detect;return t.SUBJECT===d.SPRITE&&(n=this._analyzeLocalMotion(e.target)),t.ATTRIBUTE===h.MOTION?n.motionAmount:n.motionDirection}whenMotionGreaterThan(t,e){this.detect.analyzeFrame();return this._analyzeLocalMotion(e.target).motionAmount>Number(t.REFERENCE)}videoToggle(t){const e=t.VIDEO_STATE;this.globalVideoState=e,e===p.OFF?this.runtime.ioDevices.video.disableVideo():(this.runtime.ioDevices.video.enableVideo(),this.runtime.ioDevices.video.mirror=e===p.ON)}setVideoTransparency(t){const e=a.toNumber(t.TRANSPARENCY);this.globalVideoTransparency=e,this.runtime.ioDevices.video.setPreviewGhost(e)}}t.exports=f},function(t,e,n){const r=n(61),i=n(62),s=n(7),o=function(t,e,n,i){t.attribs.id||(t.attribs.id=s());const a={id:t.attribs.id,opcode:t.attribs.type,inputs:{},fields:{},next:null,topLevel:n,parent:i,shadow:"shadow"===t.name,x:t.attribs.x,y:t.attribs.y};e[a.id]=a;for(let n=0;n<t.children.length;n++){const i=t.children[n];let s=null,c=null;for(let t=0;t<i.children.length;t++){const e=i.children[t];if(!e.name)continue;const n=e.name.toLowerCase();"block"===n?s=e:"shadow"===n&&(c=e)}switch(!s&&c&&(s=c),i.name.toLowerCase()){case"field":{const t=i.attribs.name,e=i.attribs.id;let n="";n=i.children.length>0&&i.children[0].data?i.children[0].data:"",a.fields[t]={name:t,id:e,value:n};const r=i.attribs.variabletype;"string"==typeof r&&(a.fields[t].variableType=r);break}case"comment":a.comment=i.attribs.id;break;case"value":case"statement":{o(s,e,!1,a.id),c&&s!==c&&o(c,e,!1,a.id);const t=i.attribs.name;a.inputs[t]={name:t,block:s.attribs.id,shadow:c?c.attribs.id:null};break}case"next":if(!s||!s.attribs)continue;o(s,e,!1,a.id),a.next=s.attribs.id;break;case"mutation":a.mutation=r(i)}}};t.exports=function(t){if("object"==typeof t&&"object"==typeof t.xml)return function(t){const e={};for(let n=0;n<t.length;n++){const r=t[n];if(!r.name||!r.attribs)continue;const i=r.name.toLowerCase();"block"!==i&&"shadow"!==i||o(r,e,!0,null)}const n=[];for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.push(e[t]);return n}(i.parseDOM(t.xml.outerHTML,{decodeEntities:!0}))}},function(t,e){var n={amp:"&",apos:"'",lt:"<",gt:">",quot:'"',nbsp:" "},r=/&([a-z]+);/gi;t.exports=function(t){return t.replace(r,(function(t,e){return e=e.toLowerCase(),n.hasOwnProperty(e)?n[e]:t}))}},function(t,e){let n=0;const r={},i="object"==typeof window&&window.performance;class s{constructor(t){this.id=-1,this.totalTime=0,this.selfTime=0,this.arg=null,this.depth=t,this.count=0}}class o{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){};this.records=[],this.increments=[],this.counters=[],this.nullFrame=new s(-1),this._stack=[new s(0)],this.onFrame=t,this.START=0,this.STOP=1}start(t,e){this.records.push(0,t,e,i.now())}stop(){this.records.push(1,i.now())}increment(t){this.increments[t]||(this.increments[t]=new s(-1),this.increments[t].id=t),this.increments[t].count+=1}frame(t,e){for(let n=0;n<this.counters.length;n++)if(this.counters[n].id===t&&this.counters[n].arg===e)return this.counters[n];const n=new s(-1);return n.id=t,n.arg=e,this.counters.push(n),n}reportFrames(){const t=this._stack;let e=1;for(let n=0;n<this.records.length;)if(0===this.records[n]){e>=t.length&&t.push(new s(e));const r=t[e++];r.id=this.records[n+1],r.arg=this.records[n+2],r.totalTime=this.records[n+3],r.selfTime=0,n+=4}else{if(1!==this.records[n])throw this.records.length=0,new Error("Unable to decode Profiler records.");{const r=this.records[n+1],i=t[--e];i.totalTime=r-i.totalTime,i.selfTime+=i.totalTime,t[e-1].selfTime-=i.totalTime,i.count=1,this.onFrame(i),n+=2}}for(let t=0;t<this.increments.length;t++)this.increments[t]&&this.increments[t].count>0&&(this.onFrame(this.increments[t]),this.increments[t].count=0);for(let t=0;t<this.counters.length;t++)this.counters[t].count>0&&(this.onFrame(this.counters[t]),this.counters[t].count=0);this.records.length=0}idByName(t){return o.idByName(t)}nameById(t){return o.nameById(t)}static idByName(t){return"number"!=typeof r[t]&&(r[t]=n++),r[t]}static nameById(t){for(const e in r)if(r[e]===t)return e;return null}static available(){return"object"==typeof window&&void 0!==window.performance}}o.START=0,o.STOP=1,t.exports=o},function(t,e,n){const r=n(13),i=n(22),s=n(44),o=n(43);let a=-1,c=-1,u=-1;class l{constructor(t){this.timer=new r,this.runtime=t,this.activeThread=null}static get WARP_TIME(){return 500}stepThreads(){const t=.75*this.runtime.currentStepTime;this.runtime.updateCurrentMSecs(),this.timer.start();let e=1/0,n=!1;const r=[];for(;this.runtime.threads.length>0&&e>0&&this.timer.timeElapsed()<t&&(this.runtime.turboMode||!this.runtime.redrawRequested);){null!==this.runtime.profiler&&(-1===c&&(c=this.runtime.profiler.idByName("Sequencer.stepThreads#inner")),this.runtime.profiler.start(c)),e=0;let t=!1;const s=this.runtime.threads;for(let r=0;r<s.length;r++){const o=this.activeThread=s[r];0!==o.stack.length&&o.status!==i.STATUS_DONE?(o.status!==i.STATUS_YIELD_TICK||n||(o.status=i.STATUS_RUNNING),o.status!==i.STATUS_RUNNING&&o.status!==i.STATUS_YIELD||(null!==this.runtime.profiler&&(-1===a&&(a=this.runtime.profiler.idByName("Sequencer.stepThread")),this.runtime.profiler.increment(a)),this.stepThread(o),o.warpTimer=null),o.status===i.STATUS_RUNNING&&e++,0!==o.stack.length&&o.status!==i.STATUS_DONE||(t=!0)):t=!0}if(n=!0,null!==this.runtime.profiler&&this.runtime.profiler.stop(),t){let t=0;for(let e=0;e<this.runtime.threads.length;e++){const n=this.runtime.threads[e];0!==n.stack.length&&n.status!==i.STATUS_DONE?(this.runtime.threads[t]=n,t++):(this.runtime.threadMap.delete(n.getId()),r.push(n))}this.runtime.threads.length=t}}return this.activeThread=null,r}stepThread(t){if(t.isCompiled)return void o(t);let e=t.peekStack();if(e||(t.popStack(),0!==t.stack.length))for(;e=t.peekStack();){const n=t.stack.length;let o=t.peekStackFrame().warpMode;if(o&&!t.warpTimer&&(t.warpTimer=new r,t.warpTimer.start()),null!==this.runtime.profiler&&(-1===u&&(u=this.runtime.profiler.idByName("execute")),this.runtime.profiler.increment(u)),null===t.target?this.retireThread(t):s(this,t),t.blockGlowInFrame=e,t.status===i.STATUS_YIELD){if(t.status=i.STATUS_RUNNING,o&&t.warpTimer.timeElapsed()<=l.WARP_TIME)continue;return}if(t.status===i.STATUS_PROMISE_WAIT)return;if(t.status===i.STATUS_YIELD_TICK)return;if(t.status===i.STATUS_DONE)return;for(t.stack.length!==n||t.peekStack()!==e||t.peekStackFrame().waitingReporter||t.goToNextBlock();!t.peekStack();){if(t.popStack(),0===t.stack.length)return void(t.status=i.STATUS_DONE);const e=t.peekStackFrame();if(o=e.warpMode,e.isLoop){if(!o||t.warpTimer.timeElapsed()>l.WARP_TIME)return}else e.waitingReporter||t.goToNextBlock()}}else t.status=i.STATUS_DONE}stepToBranch(t,e,n){e||(e=1);const r=t.peekStack(),i=t.target.blocks.getBranch(r,e);t.peekStackFrame().isLoop=n,i?t.pushStack(i):t.pushStack(null)}stepToProcedure(t,e){const n=t.target.blocks.getProcedureDefinition(e);if(!n)return;const r=t.isRecursiveCall(e);if(t.pushStack(n),t.peekStackFrame().warpMode&&t.warpTimer.timeElapsed()>l.WARP_TIME)t.status=i.STATUS_YIELD;else{const e=t.target.blocks.getBlock(n),s=t.target.blocks.getBlock(e.inputs.custom_block.block);let o=!1;if(s&&s.mutation){const t=s.mutation.warp;"boolean"==typeof t?o=t:"string"==typeof t&&(o=JSON.parse(t))}o?t.peekStackFrame().warpMode=!0:r&&(t.status=i.STATUS_YIELD)}}retireThread(t){t.stack=[],t.stackFrame=[],t.requestScriptGlowInFrame=!1,t.status=i.STATUS_DONE,t.isCompiled&&(t.procedures=null,t.generator=null)}}t.exports=l},function(t,e,n){const{IRGenerator:r}=n(42),i=n(66);t.exports=t=>{const e=new r(t).generate(),n={},s=t.target,o=t=>{if(t.cachedCompileResult)return t.cachedCompileResult;const n=new i(t,e,s).compile();return t.cachedCompileResult=n,n},a=o(e.entry);for(const t of Object.keys(e.procedures)){const r=o(e.procedures[t]);n[t]=r}return{startingFunction:a,procedures:n,executableHat:e.entry.executableHat}}},function(t,e){t.exports={stacked:["looks_changestretchby","looks_hideallsprites","looks_say","looks_sayforsecs","looks_setstretchto","looks_switchbackdroptoandwait","looks_think","looks_thinkforsecs","motion_align_scene","motion_glidesecstoxy","motion_glideto","motion_goto","motion_pointtowards","motion_scroll_right","motion_scroll_up","sensing_askandwait","sensing_setdragmode","sound_changeeffectby","sound_changevolumeby","sound_cleareffects","sound_play","sound_playuntildone","sound_seteffectto","sound_setvolumeto","sound_stopallsounds"],inputs:["motion_xscroll","motion_yscroll","sensing_loud","sensing_loudness","sensing_userid","sound_volume"]}},function(t,e){t.exports=class{constructor(t){if(0===t.trim().length)throw new Error("prefix cannot be empty");this.prefix=t,this.count=0}next(){return"".concat(this.prefix).concat(this.count++)}}},function(t,e,n){const r=n(67);t.exports=new class extends r{constructor(){super(),this._startedBranch=null}get stackFrame(){return this.thread.compatibilityStackFrame}startBranch(t,e){this._startedBranch=[t,e]}startProcedure(){throw new Error("startProcedure is not supported by this BlockUtility")}initParams(){throw new Error("initParams is not supported by this BlockUtility")}pushParam(){throw new Error("pushParam is not supported by this BlockUtility")}getParam(){throw new Error("getParam is not supported by this BlockUtility")}init(t,e,n){this.thread=t,this.sequencer=t.target.runtime.sequencer,this._startedBranch=null,t.stack[0]=e,t.compatibilityStackFrame=n}}},function(t,e){t.exports={supportsNullishCoalescing:(()=>{try{new Function("undefined ?? 3");return!0}catch(t){return!1}})()}},function(t,e){t.exports=class{constructor(t){this._type=t,this._onOpen=null,this._onClose=null,this._onError=null,this._handleMessage=null,this._ws=null}open(){if(!(this._onOpen&&this._onClose&&this._onError&&this._handleMessage))throw new Error("Must set open, close, message and error handlers before calling open on the socket");let t;switch(this._type){case"BLE":t="scratch/ble";break;case"BT":t="scratch/bt";break;default:throw new Error("Unknown ScratchLink socket Type: ".concat(this._type))}const e=(t,e)=>{e.onopen=e.onerror=null,e.close(),this._ws=t,this._ws.onopen=this._onOpen,this._ws.onclose=this._onClose,this._ws.onerror=this._onError,this._ws.onmessage=this._onMessage.bind(this)},n=new WebSocket("ws://127.0.0.1:20111/".concat(t)),r=new WebSocket("wss://device-manager.scratch.mit.edu:20110/".concat(t)),i=setTimeout((()=>{e(n,r),this._ws.onerror(new Event("timeout"))}),15e3);let s,o;n.onopen=t=>{clearTimeout(i),e(n,r),this._ws.onopen(t)},r.onopen=t=>{clearTimeout(i),e(r,n),this._ws.onopen(t)};const a=()=>{s&&o&&(clearTimeout(i),e(n,r),this._ws.onerror(s))};n.onerror=t=>{s=t,a()},r.onerror=t=>{o=t,a()}}close(){this._ws.close(),this._ws=null}sendMessage(t){const e=JSON.stringify(t);this._ws.send(e)}setOnOpen(t){this._onOpen=t}setOnClose(t){this._onClose=t}setOnError(t){this._onError=t}setHandleMessage(t){this._handleMessage=t}isOpen(){return this._ws&&this._ws.readyState===this._ws.OPEN}_onMessage(t){const e=JSON.parse(t.data);this._handleMessage(e)}}},function(t,e,n){const r=n(17),i=n(193),s=n(6),o=n(0),a=t=>t.replace(/[^-\w ]/g,""),c=(t,e)=>{let n;const r=t.findIndex((t=>t.family.toLowerCase()===e.family.toLowerCase()));return-1!==r&&(n=t[r],t.splice(r,1)),t.push(e),n};t.exports=class extends r{constructor(t){super(),this.runtime=t,this.fonts=[],this.restrictedFonts=new Set}restrictFont(t){if(!this.isValidSystemFont(t))throw new Error("Invalid font");this.restrictedFonts.add(t.toLowerCase());const e=this.fonts.length;this.fonts=this.fonts.filter((t=>t.system||this.isValidCustomFont(t.family))),this.fonts.length!==e&&(this.updateRenderer(),this.changed())}isValidSystemFont(t){return/^[-\w ]+$/.test(t)}isValidCustomFont(t){return/^[-\w ]+$/.test(t)&&!this.restrictedFonts.has(t.toLowerCase())}isValidFamily(t){return this.isValidSystemFont(t)&&this.isValidCustomFont(t)}getUnusedSystemFont(t){return s.caseInsensitiveUnusedName(a(t),this.fonts.map((t=>t.family)))}getUnusedCustomFont(t){return s.caseInsensitiveUnusedName(a(t),[...this.fonts.map((t=>t.family)),...this.restrictedFonts])}hasFont(t){return!!this.fonts.find((e=>e.family.toLowerCase()===t.toLowerCase()))}changed(){this.emit("change")}addSystemFont(t,e){if(!this.isValidSystemFont(t))throw new Error("Invalid system font family");const n=c(this.fonts,{system:!0,family:t,fallback:e});n&&!n.system&&this.updateRenderer(),this.changed()}addCustomFont(t,e,n){if(!this.isValidCustomFont(t))throw new Error("Invalid custom font family");c(this.fonts,{system:!1,family:t,fallback:e,asset:n}),this.updateRenderer(),this.changed()}getFonts(){return this.fonts.map((t=>({system:t.system,name:t.family,family:'"'.concat(t.family,'", ').concat(t.fallback),data:t.asset?t.asset.data:null,format:t.asset?t.asset.dataFormat:null})))}deleteFont(t){const[e]=this.fonts.splice(t,1);e.system||this.updateRenderer(),this.changed()}clear(){const t=this.fonts.some((t=>!t.system));this.fonts=[],t&&this.updateRenderer(),this.changed()}updateRenderer(){if(!this.runtime.renderer||!this.runtime.renderer.setCustomFonts)return;const t={};for(const e of this.fonts)if(!e.system){const n=e.asset.encodeDataURI(),r='@font-face { font-family: "'.concat(e.family,'"; src: url("').concat(n,'"); }');t['"'.concat(e.family,'", ').concat(e.fallback)]=r}this.runtime.renderer.setCustomFonts(t)}serializeJSON(){return 0===this.fonts.length?null:this.fonts.map((t=>{const e={system:t.system,family:t.family,fallback:t.fallback};if(!t.system){const n=t.asset;e.md5ext="".concat(n.assetId,".").concat(n.dataFormat)}return e}))}serializeAssets(){return this.fonts.filter((t=>!t.system)).map((t=>t.asset))}async deserialize(t,e,n){if(n||this.clear(),Array.isArray(t))for(const n of t)if(n&&"object"==typeof n)try{const t=n.system,r=n.family,s=n.fallback;if("boolean"!=typeof t||"string"!=typeof r||"string"!=typeof s||this.hasFont(r))continue;if(t)this.addSystemFont(r,s);else{const t=n.md5ext;if("string"!=typeof t)continue;const o=await i.getByMd5ext(this.runtime,e,this.runtime.storage.AssetType.Font,t);this.addCustomFont(r,s,o)}}catch(t){o.error("could not add font",t)}}}},function(t,e,n){const r=n(6);t.exports=class{static getByMd5ext(t,e,n,i){const s=r.splitFirst(i,"."),o=s[0],a=s[1].toLowerCase();if(e){let r=e.file(i);if(!r){const t=new RegExp("^([^/]*/)?".concat(i,"$"));r=e.file(t)[0]}if(r)return t.wrapAssetRequest((()=>r.async("uint8array").then((e=>t.storage.createAsset(n,a,e,o,!1)))))}return t.wrapAssetRequest((()=>t.storage.load(n,o,a)))}}},function(t,e){t.exports={name:"TurboWarp",url:"https://turbowarp.org/"}},function(t,e,n){const r=n(13);t.exports=class{constructor(t){this._projectTimer=new r({now:()=>t.currentMSecs}),this._projectTimer.start(),this._pausedTime=null,this._paused=!1,this.runtime=t}projectTimer(){return this._paused?this._pausedTime/1e3:this._projectTimer.timeElapsed()/1e3}pause(){this._paused=!0,this._pausedTime=this._projectTimer.timeElapsed()}resume(){this._paused=!1;const t=this._projectTimer.timeElapsed()-this._pausedTime;this._projectTimer.startTime+=t}resetProjectTimer(){this._projectTimer.start()}}},function(t,e,n){const r=n(9),i=n(0);t.exports=class{constructor(t){this.provider=null,this.runtime=t,this.stage=null}setProvider(t){this.provider=t}setStage(t){this.stage=t}postData(t){t.varUpdate&&this.updateCloudVariable(t.varUpdate)}requestCreateVariable(t){this.runtime.canAddCloudVariable()&&this.provider&&this.provider.createVariable(t.name,t.value)}requestUpdateVariable(t,e){this.provider&&this.provider.updateVariable(t,e)}requestRenameVariable(t,e){this.provider&&this.provider.renameVariable(t,e)}requestDeleteVariable(t){this.provider&&this.provider.deleteVariable(t)}updateCloudVariable(t){const e=t.name,n=this.stage.lookupVariableByNameAndType(e,r.SCALAR_TYPE);n&&n.isCloud?n.value=t.value:i.warn("Received an update for a cloud variable that does not exist: ".concat(e))}clear(){this.provider&&(this.provider.requestCloseConnection(),this.provider=null,this.stage=null)}}},function(t,e,n){const r=n(1),i={SPACE:"space",LEFT:"left arrow",UP:"up arrow",RIGHT:"right arrow",DOWN:"down arrow",ENTER:"enter",BACKSPACE:"backspace",DELETE:"delete",SHIFT:"shift",CAPS_LOCK:"caps lock",SCROLL_LOCK:"scroll lock",CONTROL:"control",ESCAPE:"escape",INSERT:"insert",HOME:"home",END:"end",PAGE_UP:"page up",PAGE_DOWN:"page down"},s=new Set(Object.values(i));t.exports=class{constructor(t){this._keysPressed=[],this.runtime=t,this.lastKeyPressed="",this._numeralKeyCodesToStringKey=new Map}_keyStringToScratchKey(t){switch(t=r.toString(t)){case" ":return i.SPACE;case"ArrowLeft":case"Left":return i.LEFT;case"ArrowUp":case"Up":return i.UP;case"Right":case"ArrowRight":return i.RIGHT;case"Down":case"ArrowDown":return i.DOWN;case"Enter":return i.ENTER;case"Backspace":return i.BACKSPACE;case"Delete":return i.DELETE;case"Shift":return i.SHIFT;case"CapsLock":return i.CAPS_LOCK;case"ScrollLock":return i.SCROLL_LOCK;case"Control":return i.CONTROL;case"Escape":return i.ESCAPE;case"Insert":return i.INSERT;case"Home":return i.HOME;case"End":return i.END;case"PageUp":return i.PAGE_UP;case"PageDown":return i.PAGE_DOWN}return t.length>1?"":t}_keyArgToScratchKey(t){if("number"==typeof t){if(t>=48&&t<=90)return String.fromCharCode(t);switch(t){case 32:return i.SPACE;case 37:return i.LEFT;case 38:return i.UP;case 39:return i.RIGHT;case 40:return i.DOWN}}return(t=r.toString(t)).length>1&&s.has(t)?t:(t.length>1&&(t=t[0])," "===t?i.SPACE:"\r"===t?i.ENTER:""===t?i.ESCAPE:t.toUpperCase())}postData(t){if(!t.key)return;const e=this._keyStringToScratchKey(t.key),n=1===e.length?e.toUpperCase():e;if(""===n)return;const r=this._keysPressed.indexOf(n);if(t.isDown?(this.lastKeyPressed=e,this.runtime.emit("KEY_PRESSED",n),r<0&&this._keysPressed.push(n)):r>-1&&this._keysPressed.splice(r,1),Object.prototype.hasOwnProperty.call(t,"keyCode")){const e=t.keyCode;if(this._numeralKeyCodesToStringKey.has(e)){const t=this._numeralKeyCodesToStringKey.get(e);if(t!==n){const e=this._keysPressed.indexOf(t);-1!==e&&this._keysPressed.splice(e,1)}}this._numeralKeyCodesToStringKey.set(e,n)}}getKeyIsDown(t){if("any"===t)return this._keysPressed.length>0;const e=this._keyArgToScratchKey(t);return this._keysPressed.indexOf(e)>-1}getLastKeyPressed(){return this.lastKeyPressed}}},function(t,e,n){const r=n(4),i=t=>Math.round(1e3*t)/1e3;t.exports=class{constructor(t){this._clientX=0,this._clientY=0,this._scratchX=0,this._scratchY=0,this._buttons=new Set,this.usesRightClickDown=!1,this._isDown=!1,this.runtime=t}_activateClickHats(t){this.runtime.startHats("event_whenthisspriteclicked",null,t),this.runtime.startHats("event_whenstageclicked",null,t)}_pickTarget(t,e){if(this.runtime.renderer){const n=this.runtime.renderer.pick(t,e);for(let t=0;t<this.runtime.targets.length;t++){const e=this.runtime.targets[t];if(Object.prototype.hasOwnProperty.call(e,"drawableID")&&e.drawableID===n)return e}}return this.runtime.getTargetForStage()}postData(t){if("number"==typeof t.x&&(this._clientX=t.x,this._scratchX=r.clamp(this.runtime.stageWidth*(t.x/t.canvasWidth-.5),-this.runtime.stageWidth/2,this.runtime.stageWidth/2)),"number"==typeof t.y&&(this._clientY=t.y,this._scratchY=r.clamp(-this.runtime.stageHeight*(t.y/t.canvasHeight-.5),-this.runtime.stageHeight/2,this.runtime.stageHeight/2)),void 0!==t.isDown){const e=void 0===t.button?0:t.button;t.isDown?this._buttons.add(e):this._buttons.delete(e);const n=this._isDown;if(this._isDown=t.isDown,n===this._isDown)return;if(t.wasDragged)return;if(!(t.x>0&&t.x<t.canvasWidth&&t.y>0&&t.y<t.canvasHeight))return;const r=this._pickTarget(t.x,t.y);if(r){const t=!n&&this._isDown,e=n&&!this._isDown;(r.draggable&&e||!r.draggable&&t)&&this._activateClickHats(r)}}}getClientX(){return this._clientX}getClientY(){return this._clientY}getScratchX(){return this.runtime.runtimeOptions.miscLimits?Math.round(this._scratchX):i(this._scratchX)}getScratchY(){return this.runtime.runtimeOptions.miscLimits?Math.round(this._scratchY):i(this._scratchY)}getIsDown(){return this._isDown}getButtonIsDown(t){return 2===t&&(this.usesRightClickDown=!0),this._buttons.has(t)}}},function(t,e){t.exports=class{constructor(t){this.runtime=t}postData(t){const e={};if(t.deltaY<0)e.KEY_OPTION="up arrow";else{if(!(t.deltaY>0))return;e.KEY_OPTION="down arrow"}this.runtime.startHats("event_whenkeypressed",e)}}},function(t,e){t.exports=class{constructor(){this._username=""}postData(t){this._username=t.username}getUsername(){return this._username}}},function(t,e,n){const r=n(1);t.exports=class{constructor(t){this.runtime=t,this._counter=0,this.runtime.on("RUNTIME_DISPOSED",this.clearCounter.bind(this))}getPrimitives(){return{control_repeat:this.repeat,control_repeat_until:this.repeatUntil,control_while:this.repeatWhile,control_for_each:this.forEach,control_forever:this.forever,control_wait:this.wait,control_wait_until:this.waitUntil,control_if:this.if,control_if_else:this.ifElse,control_stop:this.stop,control_create_clone_of:this.createClone,control_delete_this_clone:this.deleteClone,control_get_counter:this.getCounter,control_incr_counter:this.incrCounter,control_clear_counter:this.clearCounter,control_all_at_once:this.allAtOnce}}getHats(){return{control_start_as_clone:{restartExistingThreads:!1}}}repeat(t,e){const n=Math.round(r.toNumber(t.TIMES));void 0===e.stackFrame.loopCounter&&(e.stackFrame.loopCounter=n),e.stackFrame.loopCounter--,e.stackFrame.loopCounter>=0&&e.startBranch(1,!0)}repeatUntil(t,e){r.toBoolean(t.CONDITION)||e.startBranch(1,!0)}repeatWhile(t,e){r.toBoolean(t.CONDITION)&&e.startBranch(1,!0)}forEach(t,e){const n=e.target.lookupOrCreateVariable(t.VARIABLE.id,t.VARIABLE.name);void 0===e.stackFrame.index&&(e.stackFrame.index=0),e.stackFrame.index<Number(t.VALUE)&&(e.stackFrame.index++,n.value=e.stackFrame.index,e.startBranch(1,!0))}waitUntil(t,e){r.toBoolean(t.CONDITION)||e.yield()}forever(t,e){e.startBranch(1,!0)}wait(t,e){if(e.stackTimerNeedsInit()){const n=Math.max(0,1e3*r.toNumber(t.DURATION));e.startStackTimer(n),this.runtime.requestRedraw(),e.yield()}else e.stackTimerFinished()||e.yield()}if(t,e){r.toBoolean(t.CONDITION)&&e.startBranch(1,!1)}ifElse(t,e){r.toBoolean(t.CONDITION)?e.startBranch(1,!1):e.startBranch(2,!1)}stop(t,e){const n=t.STOP_OPTION;"all"===n?e.stopAll():"other scripts in sprite"===n||"other scripts in stage"===n?e.stopOtherTargetThreads():"this script"===n&&e.stopThisScript()}createClone(t,e){this._createClone(r.toString(t.CLONE_OPTION),e.target)}_createClone(t,e){let n;if(n="_myself_"===t?e:this.runtime.getSpriteTargetByName(t),!n)return;const r=n.makeClone();r&&(this.runtime.addTarget(r),r.goBehindOther(n))}deleteClone(t,e){e.target.isOriginal||(this.runtime.disposeTarget(e.target),this.runtime.stopForTarget(e.target))}getCounter(){return this._counter}clearCounter(){this._counter=0}incrCounter(){this._counter++}allAtOnce(t,e){e.startBranch(1,!1)}}},function(t,e,n){const r=n(1);t.exports=class{constructor(t){this.runtime=t,this.runtime.on("KEY_PRESSED",(t=>{this.runtime.startHats("event_whenkeypressed",{KEY_OPTION:t}),this.runtime.startHats("event_whenkeypressed",{KEY_OPTION:"any"})}))}getPrimitives(){return{event_whentouchingobject:this.touchingObject,event_broadcast:this.broadcast,event_broadcastandwait:this.broadcastAndWait,event_whengreaterthan:this.hatGreaterThanPredicate}}getHats(){return{event_whenflagclicked:{restartExistingThreads:!0},event_whenkeypressed:{restartExistingThreads:!1},event_whenthisspriteclicked:{restartExistingThreads:!0},event_whentouchingobject:{restartExistingThreads:!1,edgeActivated:!0},event_whenstageclicked:{restartExistingThreads:!0},event_whenbackdropswitchesto:{restartExistingThreads:!0},event_whengreaterthan:{restartExistingThreads:!1,edgeActivated:!0},event_whenbroadcastreceived:{restartExistingThreads:!0}}}touchingObject(t,e){return e.target.isTouchingObject(t.TOUCHINGOBJECTMENU)}hatGreaterThanPredicate(t,e){const n=r.toString(t.WHENGREATERTHANMENU).toLowerCase(),i=r.toNumber(t.VALUE);switch(n){case"timer":return e.ioQuery("clock","projectTimer")>i;case"loudness":return this.runtime.audioEngine&&this.runtime.audioEngine.getLoudness()>i}return!1}broadcast(t,e){const n=e.runtime.getTargetForStage().lookupBroadcastMsg(t.BROADCAST_OPTION.id,t.BROADCAST_OPTION.name);if(n){const t=n.name;e.startHats("event_whenbroadcastreceived",{BROADCAST_OPTION:t})}}broadcastAndWait(t,e){if(e.stackFrame.broadcastVar||(e.stackFrame.broadcastVar=e.runtime.getTargetForStage().lookupBroadcastMsg(t.BROADCAST_OPTION.id,t.BROADCAST_OPTION.name)),e.stackFrame.broadcastVar){const t=e.stackFrame.broadcastVar.name;if(!e.stackFrame.startedThreads&&(e.stackFrame.startedThreads=e.startHats("event_whenbroadcastreceived",{BROADCAST_OPTION:t}),0===e.stackFrame.startedThreads.length))return;const n=this;e.stackFrame.startedThreads.some((t=>-1!==n.runtime.threads.indexOf(t)))&&(e.stackFrame.startedThreads.every((t=>n.runtime.isWaitingThread(t)))?e.yieldTick():e.yield())}}}},function(t,e,n){const r=n(1),i=n(11),s=n(7),o=n(12),a=n(41),c=n(4);class u{constructor(t){this.runtime=t,this._onTargetChanged=this._onTargetChanged.bind(this),this._onResetBubbles=this._onResetBubbles.bind(this),this._onTargetWillExit=this._onTargetWillExit.bind(this),this._updateBubble=this._updateBubble.bind(this),this.runtime.on("PROJECT_STOP_ALL",this._onResetBubbles),this.runtime.on("targetWasRemoved",this._onTargetWillExit),this.runtime.on(u.SAY_OR_THINK,this._updateBubble)}static get DEFAULT_BUBBLE_STATE(){return{drawableId:null,onSpriteRight:!0,skinId:null,text:"",type:"say",usageId:null}}static get STATE_KEY(){return"Scratch.looks"}static get SAY_OR_THINK(){return"SAY"}static get SAY_BUBBLE_LIMIT(){return 330}static get EFFECT_GHOST_LIMIT(){return{min:0,max:100}}static get EFFECT_BRIGHTNESS_LIMIT(){return{min:-100,max:100}}_getBubbleState(t){let e=t.getCustomState(u.STATE_KEY);return e||(e=i.simple(u.DEFAULT_BUBBLE_STATE),t.setCustomState(u.STATE_KEY,e)),e}_onTargetChanged(t){this._getBubbleState(t).drawableId&&this._positionBubble(t)}_onTargetWillExit(t){const e=this._getBubbleState(t);e.drawableId&&e.skinId&&(this.runtime.renderer.destroyDrawable(e.drawableId,o.SPRITE_LAYER),this.runtime.renderer.destroySkin(e.skinId),e.drawableId=null,e.skinId=null,this.runtime.requestRedraw()),t.onTargetVisualChange=null}_onResetBubbles(){for(let t=0;t<this.runtime.targets.length;t++){this._getBubbleState(this.runtime.targets[t]).text="",this._onTargetWillExit(this.runtime.targets[t])}clearTimeout(this._bubbleTimeout)}_positionBubble(t){if(!t.visible)return;const e=this._getBubbleState(t),[n,r]=this.runtime.renderer.getCurrentSkinSize(e.drawableId);let i;try{i=t.getBoundsForBubble()}catch(e){i={left:t.x,right:t.x,top:t.y,bottom:t.y}}const s=this.runtime.renderer.getNativeSize(),o={left:-s[0]/2,right:s[0]/2,top:s[1]/2,bottom:-s[1]/2};e.onSpriteRight&&n+i.right>o.right&&i.left-n>o.left?(e.onSpriteRight=!1,this._renderBubble(t)):!e.onSpriteRight&&i.left-n<o.left&&n+i.right<o.right?(e.onSpriteRight=!0,this._renderBubble(t)):(this.runtime.renderer.updateDrawablePosition(e.drawableId,[e.onSpriteRight?Math.max(o.left,Math.min(o.right-n,i.right)):Math.min(o.right-n,Math.max(o.left,i.left-n)),Math.min(o.top,i.bottom+r)]),this.runtime.requestRedraw())}_renderBubble(t){if(!this.runtime.renderer)return;const e=this._getBubbleState(t),{type:n,text:r,onSpriteRight:i}=e;t.visible&&""!==r?(e.skinId?this.runtime.renderer.updateTextSkin(e.skinId,n,r,i,[0,0]):(t.onTargetVisualChange=this._onTargetChanged,e.drawableId=this.runtime.renderer.createDrawable(o.SPRITE_LAYER),e.skinId=this.runtime.renderer.createTextSkin(n,r,e.onSpriteRight,[0,0]),this.runtime.renderer.updateDrawableSkinId(e.drawableId,e.skinId)),this._positionBubble(t)):this._onTargetWillExit(t)}_formatBubbleText(t){return""===t?t:("number"==typeof t&&Math.abs(t)>=.01&&t%1!=0&&(t=t.toFixed(2)),t=String(t).substr(0,u.SAY_BUBBLE_LIMIT))}_updateBubble(t,e,n){const r=this._getBubbleState(t);r.type=e,r.text=this._formatBubbleText(n),r.usageId=s(),this._renderBubble(t)}getPrimitives(){return{looks_say:this.say,looks_sayforsecs:this.sayforsecs,looks_think:this.think,looks_thinkforsecs:this.thinkforsecs,looks_show:this.show,looks_hide:this.hide,looks_hideallsprites:()=>{},looks_switchcostumeto:this.switchCostume,looks_switchbackdropto:this.switchBackdrop,looks_switchbackdroptoandwait:this.switchBackdropAndWait,looks_nextcostume:this.nextCostume,looks_nextbackdrop:this.nextBackdrop,looks_changeeffectby:this.changeEffect,looks_seteffectto:this.setEffect,looks_cleargraphiceffects:this.clearEffects,looks_changesizeby:this.changeSize,looks_setsizeto:this.setSize,looks_changestretchby:()=>{},looks_setstretchto:()=>{},looks_gotofrontback:this.goToFrontBack,looks_goforwardbackwardlayers:this.goForwardBackwardLayers,looks_size:this.getSize,looks_costumenumbername:this.getCostumeNumberName,looks_backdropnumbername:this.getBackdropNumberName}}getMonitored(){return{looks_size:{isSpriteSpecific:!0,getId:t=>"".concat(t,"_size")},looks_costumenumbername:{isSpriteSpecific:!0,getId:(t,e)=>a("".concat(t,"_costumenumbername"),e)},looks_backdropnumbername:{getId:(t,e)=>a("backdropnumbername",e)}}}say(t,e){const n=t.MESSAGE;this._say(n,e.target)}_say(t,e){this.runtime.emit(u.SAY_OR_THINK,e,"say",t)}sayforsecs(t,e){this.say(t,e);const n=e.target,r=this._getBubbleState(n).usageId;return new Promise((e=>{this._bubbleTimeout=setTimeout((()=>{this._bubbleTimeout=null,this._getBubbleState(n).usageId===r&&this._updateBubble(n,"say",""),e()}),1e3*t.SECS)}))}think(t,e){this.runtime.emit(u.SAY_OR_THINK,e.target,"think",t.MESSAGE)}thinkforsecs(t,e){this.think(t,e);const n=e.target,r=this._getBubbleState(n).usageId;return new Promise((e=>{this._bubbleTimeout=setTimeout((()=>{this._bubbleTimeout=null,this._getBubbleState(n).usageId===r&&this._updateBubble(n,"think",""),e()}),1e3*t.SECS)}))}show(t,e){e.target.setVisible(!0),this._renderBubble(e.target)}hide(t,e){e.target.setVisible(!1),this._renderBubble(e.target)}_setCostume(t,e,n){if("number"==typeof e)t.setCostume(n?e:e-1);else{const i=t.getCostumeIndexByName(e.toString());-1!==i?t.setCostume(i):"next costume"===e?t.setCostume(t.currentCostume+1):"previous costume"===e?t.setCostume(t.currentCostume-1):isNaN(e)||r.isWhiteSpace(e)||t.setCostume(n?Number(e):Number(e)-1)}return[]}_setBackdrop(t,e,n){if("number"==typeof e)t.setCostume(n?e:e-1);else{const i=t.getCostumeIndexByName(e.toString());if(-1!==i)t.setCostume(i);else if("next backdrop"===e)t.setCostume(t.currentCostume+1);else if("previous backdrop"===e)t.setCostume(t.currentCostume-1);else if("random backdrop"===e){const e=t.getCostumes().length;if(e>1){const n=0,r=e-1,i=t.currentCostume,s=c.inclusiveRandIntWithout(n,r,i);t.setCostume(s)}}else isNaN(e)||r.isWhiteSpace(e)||t.setCostume(n?Number(e):Number(e)-1)}const i=t.getCostumes()[t.currentCostume].name;return this.runtime.startHats("event_whenbackdropswitchesto",{BACKDROP:i})}switchCostume(t,e){this._setCostume(e.target,t.COSTUME)}nextCostume(t,e){this._setCostume(e.target,e.target.currentCostume+1,!0)}switchBackdrop(t){this._setBackdrop(this.runtime.getTargetForStage(),t.BACKDROP)}switchBackdropAndWait(t,e){if(!e.stackFrame.startedThreads&&(e.stackFrame.startedThreads=this._setBackdrop(this.runtime.getTargetForStage(),t.BACKDROP),0===e.stackFrame.startedThreads.length))return;const n=this;e.stackFrame.startedThreads.some((t=>-1!==n.runtime.threads.indexOf(t)))&&(e.stackFrame.startedThreads.every((t=>n.runtime.isWaitingThread(t)))?e.yieldTick():e.yield())}nextBackdrop(){const t=this.runtime.getTargetForStage();this._setBackdrop(t,t.currentCostume+1,!0)}clampEffect(t,e){let n=e;switch(t){case"ghost":n=c.clamp(e,u.EFFECT_GHOST_LIMIT.min,u.EFFECT_GHOST_LIMIT.max);break;case"brightness":n=c.clamp(e,u.EFFECT_BRIGHTNESS_LIMIT.min,u.EFFECT_BRIGHTNESS_LIMIT.max)}return n}changeEffect(t,e){const n=r.toString(t.EFFECT).toLowerCase(),i=r.toNumber(t.CHANGE);if(!Object.prototype.hasOwnProperty.call(e.target.effects,n))return;let s=i+e.target.effects[n];s=this.clampEffect(n,s),e.target.setEffect(n,s)}setEffect(t,e){const n=r.toString(t.EFFECT).toLowerCase();let i=r.toNumber(t.VALUE);i=this.clampEffect(n,i),e.target.setEffect(n,i)}clearEffects(t,e){e.target.clearEffects()}changeSize(t,e){const n=r.toNumber(t.CHANGE);e.target.setSize(e.target.size+n)}setSize(t,e){const n=r.toNumber(t.SIZE);e.target.setSize(n)}goToFrontBack(t,e){e.target.isStage||("front"===t.FRONT_BACK?e.target.goToFront():e.target.goToBack())}goForwardBackwardLayers(t,e){e.target.isStage||("forward"===t.FORWARD_BACKWARD?e.target.goForwardLayers(r.toNumber(t.NUM)):e.target.goBackwardLayers(r.toNumber(t.NUM)))}getSize(t,e){return Math.round(e.target.size)}getBackdropNumberName(t){const e=this.runtime.getTargetForStage();return"number"===t.NUMBER_NAME?e.currentCostume+1:e.getCostumes()[e.currentCostume].name}getCostumeNumberName(t,e){return"number"===t.NUMBER_NAME?e.target.currentCostume+1:e.target.getCostumes()[e.target.currentCostume].name}}t.exports=u},function(t,e,n){const r=n(1),i=n(4),s=n(13);t.exports=class{constructor(t){this.runtime=t}getPrimitives(){return{motion_movesteps:this.moveSteps,motion_gotoxy:this.goToXY,motion_goto:this.goTo,motion_turnright:this.turnRight,motion_turnleft:this.turnLeft,motion_pointindirection:this.pointInDirection,motion_pointtowards:this.pointTowards,motion_glidesecstoxy:this.glide,motion_glideto:this.glideTo,motion_ifonedgebounce:this.ifOnEdgeBounce,motion_setrotationstyle:this.setRotationStyle,motion_changexby:this.changeX,motion_setx:this.setX,motion_changeyby:this.changeY,motion_sety:this.setY,motion_xposition:this.getX,motion_yposition:this.getY,motion_direction:this.getDirection,motion_scroll_right:()=>{},motion_scroll_up:()=>{},motion_align_scene:()=>{},motion_xscroll:()=>{},motion_yscroll:()=>{}}}getMonitored(){return{motion_xposition:{isSpriteSpecific:!0,getId:t=>"".concat(t,"_xposition")},motion_yposition:{isSpriteSpecific:!0,getId:t=>"".concat(t,"_yposition")},motion_direction:{isSpriteSpecific:!0,getId:t=>"".concat(t,"_direction")}}}moveSteps(t,e){const n=r.toNumber(t.STEPS);this._moveSteps(n,e.target)}_moveSteps(t,e){const n=i.degToRad(90-e.direction),r=t*Math.cos(n),s=t*Math.sin(n);e.setXY(e.x+r,e.y+s)}goToXY(t,e){const n=r.toNumber(t.X),i=r.toNumber(t.Y);e.target.setXY(n,i)}getTargetXY(t,e){let n=0,i=0;if("_mouse_"===t)n=e.ioQuery("mouse","getScratchX"),i=e.ioQuery("mouse","getScratchY");else if("_random_"===t){const t=this.runtime.stageWidth,e=this.runtime.stageHeight;n=Math.round(t*(Math.random()-.5)),i=Math.round(e*(Math.random()-.5))}else{t=r.toString(t);const e=this.runtime.getSpriteTargetByName(t);if(!e)return;n=e.x,i=e.y}return[n,i]}goTo(t,e){const n=this.getTargetXY(t.TO,e);n&&e.target.setXY(n[0],n[1])}turnRight(t,e){const n=r.toNumber(t.DEGREES);e.target.setDirection(e.target.direction+n)}turnLeft(t,e){const n=r.toNumber(t.DEGREES);e.target.setDirection(e.target.direction-n)}pointInDirection(t,e){const n=r.toNumber(t.DIRECTION);e.target.setDirection(n)}pointTowards(t,e){let n=0,s=0;if("_mouse_"===t.TOWARDS)n=e.ioQuery("mouse","getScratchX"),s=e.ioQuery("mouse","getScratchY");else{if("_random_"===t.TOWARDS)return void e.target.setDirection(Math.round(360*Math.random())-180);{t.TOWARDS=r.toString(t.TOWARDS);const e=this.runtime.getSpriteTargetByName(t.TOWARDS);if(!e)return;n=e.x,s=e.y}}const o=n-e.target.x,a=s-e.target.y,c=90-i.radToDeg(Math.atan2(a,o));e.target.setDirection(c)}glide(t,e){if(e.stackFrame.timer){const t=e.stackFrame.timer.timeElapsed();if(t<1e3*e.stackFrame.duration){const n=t/(1e3*e.stackFrame.duration),r=n*(e.stackFrame.endX-e.stackFrame.startX),i=n*(e.stackFrame.endY-e.stackFrame.startY);e.target.setXY(e.stackFrame.startX+r,e.stackFrame.startY+i),e.yield()}else e.target.setXY(e.stackFrame.endX,e.stackFrame.endY)}else{if(e.stackFrame.timer=new s,e.stackFrame.timer.start(),e.stackFrame.duration=r.toNumber(t.SECS),e.stackFrame.startX=e.target.x,e.stackFrame.startY=e.target.y,e.stackFrame.endX=r.toNumber(t.X),e.stackFrame.endY=r.toNumber(t.Y),e.stackFrame.duration<=0)return void e.target.setXY(e.stackFrame.endX,e.stackFrame.endY);e.yield()}}glideTo(t,e){const n=this.getTargetXY(t.TO,e);n&&this.glide({SECS:t.SECS,X:n[0],Y:n[1]},e)}ifOnEdgeBounce(t,e){this._ifOnEdgeBounce(e.target)}_ifOnEdgeBounce(t){const e=t.getBounds();if(!e)return;const n=this.runtime.stageWidth,r=this.runtime.stageHeight,s=Math.max(0,n/2+e.left),o=Math.max(0,r/2-e.top),a=Math.max(0,n/2-e.right),c=Math.max(0,r/2+e.bottom);let u="",l=1/0;if(s<l&&(l=s,u="left"),o<l&&(l=o,u="top"),a<l&&(l=a,u="right"),c<l&&(l=c,u="bottom"),l>0)return;const h=i.degToRad(90-t.direction);let d=Math.cos(h),p=-Math.sin(h);"left"===u?d=Math.max(.2,Math.abs(d)):"top"===u?p=Math.max(.2,Math.abs(p)):"right"===u?d=0-Math.max(.2,Math.abs(d)):"bottom"===u&&(p=0-Math.max(.2,Math.abs(p)));const f=i.radToDeg(Math.atan2(p,d))+90;t.setDirection(f);const m=t.keepInFence(t.x,t.y);t.setXY(m[0],m[1])}setRotationStyle(t,e){e.target.setRotationStyle(t.STYLE)}changeX(t,e){const n=r.toNumber(t.DX);e.target.setXY(e.target.x+n,e.target.y)}setX(t,e){const n=r.toNumber(t.X);e.target.setXY(n,e.target.y)}changeY(t,e){const n=r.toNumber(t.DY);e.target.setXY(e.target.x,e.target.y+n)}setY(t,e){const n=r.toNumber(t.Y);e.target.setXY(e.target.x,n)}getX(t,e){return this.limitPrecision(e.target.x)}getY(t,e){return this.limitPrecision(e.target.y)}getDirection(t,e){return e.target.direction}limitPrecision(t){const e=Math.round(t),n=t-e;return Math.abs(n)<1e-9?e:t}}},function(t,e,n){const r=n(1),i=n(4);t.exports=class{constructor(t){this.runtime=t}getPrimitives(){return{operator_add:this.add,operator_subtract:this.subtract,operator_multiply:this.multiply,operator_divide:this.divide,operator_lt:this.lt,operator_equals:this.equals,operator_gt:this.gt,operator_and:this.and,operator_or:this.or,operator_not:this.not,operator_random:this.random,operator_join:this.join,operator_letter_of:this.letterOf,operator_length:this.length,operator_contains:this.contains,operator_mod:this.mod,operator_round:this.round,operator_mathop:this.mathop}}add(t){return r.toNumber(t.NUM1)+r.toNumber(t.NUM2)}subtract(t){return r.toNumber(t.NUM1)-r.toNumber(t.NUM2)}multiply(t){return r.toNumber(t.NUM1)*r.toNumber(t.NUM2)}divide(t){return r.toNumber(t.NUM1)/r.toNumber(t.NUM2)}lt(t){return r.compare(t.OPERAND1,t.OPERAND2)<0}equals(t){return 0===r.compare(t.OPERAND1,t.OPERAND2)}gt(t){return r.compare(t.OPERAND1,t.OPERAND2)>0}and(t){return r.toBoolean(t.OPERAND1)&&r.toBoolean(t.OPERAND2)}or(t){return r.toBoolean(t.OPERAND1)||r.toBoolean(t.OPERAND2)}not(t){return!r.toBoolean(t.OPERAND)}random(t){return this._random(t.FROM,t.TO)}_random(t,e){const n=r.toNumber(t),i=r.toNumber(e),s=n<=i?n:i,o=n<=i?i:n;return s===o?s:r.isInt(t)&&r.isInt(e)?s+Math.floor(Math.random()*(o+1-s)):Math.random()*(o-s)+s}join(t){return r.toString(t.STRING1)+r.toString(t.STRING2)}letterOf(t){const e=r.toNumber(t.LETTER)-1,n=r.toString(t.STRING);return e<0||e>=n.length?"":n.charAt(e)}length(t){return r.toString(t.STRING).length}contains(t){const e=function(t){return r.toString(t).toLowerCase()};return e(t.STRING1).includes(e(t.STRING2))}mod(t){const e=r.toNumber(t.NUM1),n=r.toNumber(t.NUM2);let i=e%n;return i/n<0&&(i+=n),i}round(t){return Math.round(r.toNumber(t.NUM))}mathop(t){const e=r.toString(t.OPERATOR).toLowerCase(),n=r.toNumber(t.NUM);switch(e){case"abs":return Math.abs(n);case"floor":return Math.floor(n);case"ceiling":return Math.ceil(n);case"sqrt":return Math.sqrt(n);case"sin":return Math.round(1e10*Math.sin(Math.PI*n/180))/1e10;case"cos":return Math.round(1e10*Math.cos(Math.PI*n/180))/1e10;case"tan":return i.tan(n);case"asin":return 180*Math.asin(n)/Math.PI;case"acos":return 180*Math.acos(n)/Math.PI;case"atan":return 180*Math.atan(n)/Math.PI;case"ln":return Math.log(n);case"log":return Math.log(n)/Math.LN10;case"e ^":return Math.exp(n);case"10 ^":return Math.pow(10,n)}return 0}}},function(t,e,n){const r=n(4),i=n(1),s=n(11),o=!0;class a{constructor(t){this.runtime=t,this.waitingSounds={},this.stopAllSounds=this.stopAllSounds.bind(this),this._stopWaitingSoundsForTarget=this._stopWaitingSoundsForTarget.bind(this),this._clearEffectsForAllTargets=this._clearEffectsForAllTargets.bind(this),this.runtime&&(this.runtime.on("PROJECT_STOP_ALL",this.stopAllSounds),this.runtime.on("PROJECT_STOP_ALL",this._clearEffectsForAllTargets),this.runtime.on("STOP_FOR_TARGET",this._stopWaitingSoundsForTarget),this.runtime.on("PROJECT_START",this._clearEffectsForAllTargets)),this._onTargetCreated=this._onTargetCreated.bind(this),this.runtime&&t.on("targetWasCreated",this._onTargetCreated)}static get STATE_KEY(){return"Scratch.sound"}static get DEFAULT_SOUND_STATE(){return{effects:{pitch:0,pan:0}}}static get MIDI_NOTE_RANGE(){return{min:36,max:96}}static get BEAT_RANGE(){return{min:0,max:100}}static get TEMPO_RANGE(){return{min:20,max:500}}static get EFFECT_RANGE(){return{pitch:{min:-360,max:360},pan:{min:-100,max:100}}}static get LARGER_EFFECT_RANGE(){return{pitch:{min:-1e3,max:1e3},pan:{min:-100,max:100}}}_getSoundState(t){let e=t.getCustomState(a.STATE_KEY);return e||(e=s.simple(a.DEFAULT_SOUND_STATE),t.setCustomState(a.STATE_KEY,e),t.soundEffects=e.effects),e}_onTargetCreated(t,e){if(e){const n=e.getCustomState(a.STATE_KEY);n&&t&&(t.setCustomState(a.STATE_KEY,s.simple(n)),this._syncEffectsForTarget(t))}}getPrimitives(){return{sound_play:this.playSound,sound_playuntildone:this.playSoundAndWait,sound_stopallsounds:this.stopAllSounds,sound_seteffectto:this.setEffect,sound_changeeffectby:this.changeEffect,sound_cleareffects:this.clearEffects,sound_sounds_menu:this.soundsMenu,sound_beats_menu:this.beatsMenu,sound_effects_menu:this.effectsMenu,sound_setvolumeto:this.setVolume,sound_changevolumeby:this.changeVolume,sound_volume:this.getVolume}}getMonitored(){return{sound_volume:{isSpriteSpecific:!0,getId:t=>"".concat(t,"_volume")}}}playSound(t,e){this._playSound(t,e)}playSoundAndWait(t,e){return this._playSound(t,e,o)}_playSound(t,e,n){const r=this._getSoundIndex(t.SOUND_MENU,e);if(r>=0){const{target:t}=e,{sprite:i}=t,{soundId:s}=i.sounds[r];if(i.soundBank)return n===o?this._addWaitingSound(t.id,s):this._removeWaitingSound(t.id,s),i.soundBank.playSound(t,s)}}_addWaitingSound(t,e){this.waitingSounds[t]||(this.waitingSounds[t]=new Set),this.waitingSounds[t].add(e)}_removeWaitingSound(t,e){this.waitingSounds[t]&&this.waitingSounds[t].delete(e)}_getSoundIndex(t,e){const n=e.target.sprite.sounds.length;if(0===n)return-1;const i=this.getSoundIndexByName(t,e);if(-1!==i)return i;const s=parseInt(t,10);return isNaN(s)?-1:r.wrapClamp(s-1,0,n-1)}getSoundIndexByName(t,e){const n=e.target.sprite.sounds;for(let e=0;e<n.length;e++)if(n[e].name===t)return e;return-1}stopAllSounds(){if(null===this.runtime.targets)return;const t=this.runtime.targets;for(let e=0;e<t.length;e++)this._stopAllSoundsForTarget(t[e])}_stopAllSoundsForTarget(t){t.sprite.soundBank&&(t.sprite.soundBank.stopAllSounds(t),this.waitingSounds[t.id]&&this.waitingSounds[t.id].clear())}_stopWaitingSoundsForTarget(t){if(t.sprite.soundBank&&this.waitingSounds[t.id]){for(const e of this.waitingSounds[t.id].values())t.sprite.soundBank.stop(t,e);this.waitingSounds[t.id].clear()}}setEffect(t,e){return this._updateEffect(t,e,!1)}changeEffect(t,e){return this._updateEffect(t,e,!0)}_updateEffect(t,e,n){const s=i.toString(t.EFFECT).toLowerCase(),o=i.toNumber(t.VALUE),c=this._getSoundState(e.target);if(!Object.prototype.hasOwnProperty.call(c.effects,s))return;n?c.effects[s]+=o:c.effects[s]=o;const u=this.runtime.runtimeOptions.miscLimits,{min:l,max:h}=u?a.EFFECT_RANGE[s]:a.LARGER_EFFECT_RANGE[s];if(c.effects[s]=r.clamp(c.effects[s],l,h),this._syncEffectsForTarget(e.target),u)return Promise.resolve();this.runtime.requestRedraw()}_syncEffectsForTarget(t){t&&t.sprite.soundBank&&(t.soundEffects=this._getSoundState(t).effects,t.sprite.soundBank.setEffects(t))}clearEffects(t,e){this._clearEffectsForTarget(e.target)}_clearEffectsForTarget(t){const e=this._getSoundState(t);for(const t in e.effects)Object.prototype.hasOwnProperty.call(e.effects,t)&&(e.effects[t]=0);this._syncEffectsForTarget(t)}_clearEffectsForAllTargets(){if(null===this.runtime.targets)return;const t=this.runtime.targets;for(let e=0;e<t.length;e++)this._clearEffectsForTarget(t[e])}setVolume(t,e){const n=i.toNumber(t.VOLUME);return this._updateVolume(n,e)}changeVolume(t,e){const n=i.toNumber(t.VOLUME)+e.target.volume;return this._updateVolume(n,e)}_updateVolume(t,e){if(t=r.clamp(t,0,100),e.target.volume=t,this._syncEffectsForTarget(e.target),this.runtime.runtimeOptions.miscLimits)return Promise.resolve();this.runtime.requestRedraw()}getVolume(t,e){return e.target.volume}soundsMenu(t){return t.SOUND_MENU}beatsMenu(t){return t.BEATS}effectsMenu(t){return t.EFFECT}}t.exports=a},function(t,e,n){const r=n(1),i=n(13),s=n(41);t.exports=class{constructor(t){this.runtime=t,this._answer="",this._timer=new i,this._cachedLoudness=-1,this._cachedLoudnessTimestamp=0,this._questionList=[],this.runtime.on("ANSWER",this._onAnswer.bind(this)),this.runtime.on("PROJECT_START",this._resetAnswer.bind(this)),this.runtime.on("PROJECT_STOP_ALL",this._clearAllQuestions.bind(this)),this.runtime.on("STOP_FOR_TARGET",this._clearTargetQuestions.bind(this)),this.runtime.on("RUNTIME_DISPOSED",this._resetAnswer.bind(this))}getPrimitives(){return{sensing_touchingobject:this.touchingObject,sensing_touchingcolor:this.touchingColor,sensing_coloristouchingcolor:this.colorTouchingColor,sensing_distanceto:this.distanceTo,sensing_timer:this.getTimer,sensing_resettimer:this.resetTimer,sensing_of:this.getAttributeOf,sensing_mousex:this.getMouseX,sensing_mousey:this.getMouseY,sensing_setdragmode:this.setDragMode,sensing_mousedown:this.getMouseDown,sensing_keypressed:this.getKeyPressed,sensing_current:this.current,sensing_dayssince2000:this.daysSince2000,sensing_loudness:this.getLoudness,sensing_loud:this.isLoud,sensing_askandwait:this.askAndWait,sensing_answer:this.getAnswer,sensing_username:this.getUsername,sensing_userid:()=>{}}}getMonitored(){return{sensing_answer:{getId:()=>"answer"},sensing_mousedown:{getId:()=>"mousedown"},sensing_mousex:{getId:()=>"mousex"},sensing_mousey:{getId:()=>"mousey"},sensing_loudness:{getId:()=>"loudness"},sensing_timer:{getId:()=>"timer"},sensing_dayssince2000:{getId:()=>"dayssince2000"},sensing_current:{getId:(t,e)=>s("current",e)}}}_onAnswer(t){this._answer=t;const e=this._questionList.shift();if(e){const[t,n,r,i,s]=e;i&&!s&&this.runtime.emit("SAY",r,"say",""),n(),this._askNextQuestion()}}_resetAnswer(){this._answer=""}_enqueueAsk(t,e,n,r,i){this._questionList.push([t,e,n,r,i])}_askNextQuestion(){if(this._questionList.length>0){const[t,e,n,r,i]=this._questionList[0];r&&!i?(this.runtime.emit("SAY",n,"say",t),this.runtime.emit("QUESTION","")):this.runtime.emit("QUESTION",t)}}_clearAllQuestions(){this._questionList=[],this.runtime.emit("QUESTION",null)}_clearTargetQuestions(t){const e=this._questionList.length>0&&this._questionList[0][2]===t;this._questionList=this._questionList.filter((e=>e[2]!==t)),e&&(this.runtime.emit("SAY",t,"say",""),this._questionList.length>0?this._askNextQuestion():this.runtime.emit("QUESTION",null))}askAndWait(t,e){const n=e.target;return new Promise((e=>{const r=this._questionList.length>0;this._enqueueAsk(String(t.QUESTION),e,n,n.visible,n.isStage),r||this._askNextQuestion()}))}getAnswer(){return this._answer}touchingObject(t,e){return e.target.isTouchingObject(t.TOUCHINGOBJECTMENU)}touchingColor(t,e){const n=r.toRgbColorList(t.COLOR);return e.target.isTouchingColor(n)}colorTouchingColor(t,e){const n=r.toRgbColorList(t.COLOR),i=r.toRgbColorList(t.COLOR2);return e.target.colorIsTouchingColor(i,n)}distanceTo(t,e){if(e.target.isStage)return 1e4;let n=0,i=0;if("_mouse_"===t.DISTANCETOMENU)n=e.ioQuery("mouse","getScratchX"),i=e.ioQuery("mouse","getScratchY");else{t.DISTANCETOMENU=r.toString(t.DISTANCETOMENU);const e=this.runtime.getSpriteTargetByName(t.DISTANCETOMENU);if(!e)return 1e4;n=e.x,i=e.y}const s=e.target.x-n,o=e.target.y-i;return Math.sqrt(s*s+o*o)}setDragMode(t,e){e.target.setDraggable("draggable"===t.DRAG_MODE)}getTimer(t,e){return e.ioQuery("clock","projectTimer")}resetTimer(t,e){e.ioQuery("clock","resetProjectTimer")}getMouseX(t,e){return e.ioQuery("mouse","getScratchX")}getMouseY(t,e){return e.ioQuery("mouse","getScratchY")}getMouseDown(t,e){return e.ioQuery("mouse","getIsDown")}current(t){const e=r.toString(t.CURRENTMENU).toLowerCase(),n=new Date;switch(e){case"year":return n.getFullYear();case"month":return n.getMonth()+1;case"date":return n.getDate();case"dayofweek":return n.getDay()+1;case"hour":return n.getHours();case"minute":return n.getMinutes();case"second":return n.getSeconds()}return 0}getKeyPressed(t,e){return e.ioQuery("keyboard","getKeyIsDown",[t.KEY_OPTION])}daysSince2000(){const t=new Date(2e3,0,1),e=new Date,n=e.getTimezoneOffset()-t.getTimezoneOffset();let r=e.valueOf()-t.valueOf();return r+=60*(e.getTimezoneOffset()-n)*1e3,r/864e5}getLoudness(){if(void 0===this.runtime.audioEngine)return-1;if(null===this.runtime.currentStepTime)return-1;return this._timer.time()-this._cachedLoudnessTimestamp<this.runtime.currentStepTime||(this._cachedLoudnessTimestamp=this._timer.time(),this._cachedLoudness=this.runtime.audioEngine.getLoudness()),this._cachedLoudness}isLoud(){return this.getLoudness()>10}getAttributeOf(t){let e;if("_stage_"===t.OBJECT?e=this.runtime.getTargetForStage():(t.OBJECT=r.toString(t.OBJECT),e=this.runtime.getSpriteTargetByName(t.OBJECT)),!e)return 0;if(e.isStage)switch(t.PROPERTY){case"background #":case"backdrop #":return e.currentCostume+1;case"backdrop name":return e.getCostumes()[e.currentCostume].name;case"volume":return e.volume}else switch(t.PROPERTY){case"x position":return e.x;case"y position":return e.y;case"direction":return e.direction;case"costume #":return e.currentCostume+1;case"costume name":return e.getCostumes()[e.currentCostume].name;case"size":return e.size;case"volume":return e.volume}const n=t.PROPERTY,i=e.lookupVariableByNameAndType(n,"",!0);return i?i.value:0}getUsername(t,e){return e.ioQuery("userData","getUsername")}}},function(t,e,n){const r=n(1);t.exports=class{constructor(t){this.runtime=t}getPrimitives(){return{data_variable:this.getVariable,data_setvariableto:this.setVariableTo,data_changevariableby:this.changeVariableBy,data_hidevariable:this.hideVariable,data_showvariable:this.showVariable,data_listcontents:this.getListContents,data_addtolist:this.addToList,data_deleteoflist:this.deleteOfList,data_deletealloflist:this.deleteAllOfList,data_insertatlist:this.insertAtList,data_replaceitemoflist:this.replaceItemOfList,data_itemoflist:this.getItemOfList,data_itemnumoflist:this.getItemNumOfList,data_lengthoflist:this.lengthOfList,data_listcontainsitem:this.listContainsItem,data_hidelist:this.hideList,data_showlist:this.showList}}getVariable(t,e){return e.target.lookupOrCreateVariable(t.VARIABLE.id,t.VARIABLE.name).value}setVariableTo(t,e){const n=e.target.lookupOrCreateVariable(t.VARIABLE.id,t.VARIABLE.name);n.value=t.VALUE,n.isCloud&&e.ioQuery("cloud","requestUpdateVariable",[n.name,t.VALUE])}changeVariableBy(t,e){const n=e.target.lookupOrCreateVariable(t.VARIABLE.id,t.VARIABLE.name),i=r.toNumber(n.value)+r.toNumber(t.VALUE);n.value=i,n.isCloud&&e.ioQuery("cloud","requestUpdateVariable",[n.name,i])}changeMonitorVisibility(t,e){this.runtime.monitorBlocks.changeBlock({id:t,element:"checkbox",value:e},this.runtime)}showVariable(t){this.changeMonitorVisibility(t.VARIABLE.id,!0)}hideVariable(t){this.changeMonitorVisibility(t.VARIABLE.id,!1)}showList(t){this.changeMonitorVisibility(t.LIST.id,!0)}hideList(t){this.changeMonitorVisibility(t.LIST.id,!1)}getListContents(t,e){const n=e.target.lookupOrCreateList(t.LIST.id,t.LIST.name);if(e.thread.updateMonitor)return n._monitorUpToDate?n.value:(n._monitorUpToDate=!0,n.value.slice());let r=!0;for(let t=0;t<n.value.length;t++){const e=n.value[t];if("string"!=typeof e||1!==e.length){r=!1;break}}return r?n.value.join(""):n.value.join(" ")}addToList(t,e){const n=e.target.lookupOrCreateList(t.LIST.id,t.LIST.name);n.value.push(t.ITEM),n._monitorUpToDate=!1}deleteOfList(t,e){const n=e.target.lookupOrCreateList(t.LIST.id,t.LIST.name),i=r.toListIndex(t.INDEX,n.value.length,!0);i!==r.LIST_INVALID&&(i!==r.LIST_ALL?(n.value.splice(i-1,1),n._monitorUpToDate=!1):n.value=[])}deleteAllOfList(t,e){e.target.lookupOrCreateList(t.LIST.id,t.LIST.name).value=[]}insertAtList(t,e){const n=t.ITEM,i=e.target.lookupOrCreateList(t.LIST.id,t.LIST.name),s=r.toListIndex(t.INDEX,i.value.length+1,!1);s!==r.LIST_INVALID&&(i.value.splice(s-1,0,n),i._monitorUpToDate=!1)}replaceItemOfList(t,e){const n=t.ITEM,i=e.target.lookupOrCreateList(t.LIST.id,t.LIST.name),s=r.toListIndex(t.INDEX,i.value.length,!1);s!==r.LIST_INVALID&&(i.value[s-1]=n,i._monitorUpToDate=!1)}getItemOfList(t,e){const n=e.target.lookupOrCreateList(t.LIST.id,t.LIST.name),i=r.toListIndex(t.INDEX,n.value.length,!1);return i===r.LIST_INVALID?"":n.value[i-1]}getItemNumOfList(t,e){const n=t.ITEM,i=e.target.lookupOrCreateList(t.LIST.id,t.LIST.name);for(let t=0;t<i.value.length;t++)if(0===r.compare(i.value[t],n))return t+1;return 0}lengthOfList(t,e){return e.target.lookupOrCreateList(t.LIST.id,t.LIST.name).value.length}listContainsItem(t,e){const n=t.ITEM,i=e.target.lookupOrCreateList(t.LIST.id,t.LIST.name);if(i.value.indexOf(n)>=0)return!0;for(let t=0;t<i.value.length;t++)if(0===r.compare(i.value[t],n))return!0;return!1}}},function(t,e){t.exports=class{constructor(t){this.runtime=t}getPrimitives(){return{procedures_definition:this.definition,procedures_call:this.call,procedures_return:this.return,argument_reporter_string_number:this.argumentReporterStringNumber,argument_reporter_boolean:this.argumentReporterBoolean}}definition(){}call(t,e){const n=e.stackFrame,r=!!t.mutation.return;if(n.executed){if(r){const t=n.returnValue;return e.thread.peekStackFrame().params=null,delete n.returnValue,delete n.executed,t}return}const i=t.mutation.proccode,s=e.getProcedureParamNamesIdsAndDefaults(i);if(null===s)return r?"":void 0;const[o,a,c]=s;e.initParams();for(let n=0;n<a.length;n++)Object.prototype.hasOwnProperty.call(t,a[n])?e.pushParam(o[n],t[a[n]]):e.pushParam(o[n],c[n]);const u=e.runtime.getAddonBlock(i);if(u){const t=u.callback(e.thread.getAllparams(),e);return 1===e.thread.status&&(n.executed=!0),t}n.executed=!0,r&&(e.thread.peekStackFrame().waitingReporter=!0,n.returnValue=""),e.startProcedure(i)}return(t,e){e.stopThisScript(),e.thread.peekStackFrame()&&(e.stackFrame.returnValue=t.VALUE)}argumentReporterStringNumber(t,e){const n=e.getParam(t.VALUE);return null===n?"last key pressed"===String(t.VALUE).toLowerCase()?e.ioQuery("keyboard","getLastKeyPressed"):0:n}argumentReporterBoolean(t,e){const n=e.getParam(t.VALUE);if(null===n){const n=String(t.VALUE).toLowerCase();return!(!e.target.runtime.compilerOptions.enabled||"is compiled?"!==n)||("is turbowarp?"===n||0)}return n}}},function(t,e){t.exports={setupInitialState:t=>{const e=t.renderer;for(const n of t.targets){const t=n._getRenderedDirectionAndScale();if(e&&n.interpolationData){const r=n.drawableID;e.updateDrawablePosition(r,[n.x,n.y]),e.updateDrawableDirectionScale(r,t.direction,t.scale),e.updateDrawableEffect(r,"ghost",n.effects.ghost)}n.visible&&!n.isStage?n.interpolationData={x:n.x,y:n.y,direction:t.direction,scale:t.scale,costume:n.currentCostume,ghost:n.effects.ghost}:n.interpolationData=null}},interpolate:(t,e)=>{const n=t.renderer;if(n)for(const r of t.targets){const t=r.interpolationData;if(!t)continue;if(!r.visible)continue;const i=r.drawableID,s=r.x-t.x,o=r.y-t.y,a=Math.abs(s),c=Math.abs(o);if(a>.1||c>.1){const r=n._allDrawables[i].getAABB(),u=Math.min(240,Math.max(50,1.5*(r.width+r.height)));if(Math.sqrt(a**2+c**2)<u){const r=t.x+s*e,a=t.y+o*e;n.updateDrawablePosition(i,[r,a])}}const u=r.effects.ghost-t.ghost,l=Math.abs(u);if(l>0&&l<25){const t=r.effects.ghost+u*e;n.updateDrawableEffect(i,"ghost",t)}if(t.costume===r.currentCostume){let{direction:s,scale:o}=r._getRenderedDirectionAndScale(),a=!1;if(s!==t.direction&&(s%90!=0||t.direction%90!=0)){const n=s*Math.PI/180,r=t.direction*Math.PI/180;s=180*Math.atan2(Math.sin(n)*e+Math.sin(r)*(1-e),Math.cos(n)*e+Math.cos(r)*(1-e))/Math.PI,a=!0}const c=t.scale;if((o[0]!==c[0]||o[1]!==c[1])&&Math.sign(o[0])===Math.sign(c[0])&&Math.sign(o[1])===Math.sign(c[1])){const t=o[0]-c[0],n=o[1]-c[1],r=Math.abs(t),i=Math.abs(n);r<100&&i<100&&(o[0]=c[0]+t*e,o[1]=c[1]+n*e,a=!0)}a&&n.updateDrawableDirectionScale(i,s,o)}}}}},function(t,e){const n="function"==typeof requestAnimationFrame?requestAnimationFrame:t=>setTimeout(t,1e3/60),r="function"==typeof requestAnimationFrame?cancelAnimationFrame:clearTimeout,i=t=>{let e;const i=()=>{e=n(i),t()};return e=n(i),{cancel:()=>r(e)}};t.exports=class{constructor(t){this.runtime=t,this.running=!1,this.setFramerate(30),this.setInterpolation(!1),this.stepCallback=this.stepCallback.bind(this),this.interpolationCallback=this.interpolationCallback.bind(this),this._stepInterval=null,this._interpolationAnimation=null,this._stepAnimation=null}setFramerate(t){this.framerate=t,this._restart()}setInterpolation(t){this.interpolation=t,this._restart()}stepCallback(){this.runtime._step()}interpolationCallback(){this.runtime._renderInterpolatedPositions()}_restart(){this.running&&(this.stop(),this.start())}start(){this.running=!0,0===this.framerate?(this._stepAnimation=i(this.stepCallback),this.runtime.currentStepTime=1e3/60):(this.interpolation&&(this._interpolationAnimation=i(this.interpolationCallback)),this._stepInterval=setInterval(this.stepCallback,1e3/this.framerate),this.runtime.currentStepTime=1e3/this.framerate)}stop(){this.running=!1,clearInterval(this._stepInterval),this._interpolationAnimation&&this._interpolationAnimation.cancel(),this._stepAnimation&&this._stepAnimation.cancel(),this._interpolationAnimation=null,this._stepAnimation=null}}},function(t,e,n){const{motionVector:r,scratchAtan2:i}=n(213),s=480,o=10/3;t.exports=class{constructor(){this.frameNumber=0,this.lastAnalyzedFrame=0,this.motionAmount=0,this.motionDirection=0,this.curr=null,this.prev=null,this._arrays=new ArrayBuffer(345600),this._curr=new Uint8ClampedArray(this._arrays,0,172800),this._prev=new Uint8ClampedArray(this._arrays,172800,172800)}reset(){this.frameNumber=0,this.lastAnalyzedFrame=0,this.motionAmount=this.motionDirection=0,this.prev=this.curr=null}addFrame(t){this.frameNumber++,this.prev=this.curr,this.curr=new Uint32Array(t.buffer.slice(0));const e=this._prev;this._prev=this._curr,this._curr=e;for(let t=0;t<this.curr.length;t++)this._curr[t]=255&this.curr[t]}analyzeFrame(){if(!this.curr||!this.prev)return void(this.motionAmount=this.motionDirection=-1);if(this.lastAnalyzedFrame===this.frameNumber)return;this.lastAnalyzedFrame=this.frameNumber;const{_curr:t,_prev:e}=this,n=17;let o=0,a=0,c=0;for(let i=9;i<351;i+=n)for(let u=9;u<471;u+=n){let l=0,h=0,d=0,p=0,f=0,m=(i-8)*s+u-8,g=m+n;const b=(i+8)*s+u+8;for(;m<=b;m+=463,g+=s)for(;m<=g;m+=1){const n=e[m]-t[m],r=t[m-1]-t[m+1],i=t[m-s]-t[m+s];l+=r*r,h+=r*i,d+=i*i,f+=r*n,p+=i*n}const{u:y,v:v}=r(l,h,d,f,p);-17<y&&y<n&&-17<v&&v<n&&(o+=y,a+=v,c++)}o/=c,a/=c,this.motionAmount=Math.round(100*Math.hypot(o,a)),this.motionAmount>10&&(this.motionDirection=i(a,o))}getLocalMotion(t,e){if(this.curr&&this.prev){if(e.motionFrameNumber!==this.frameNumber){const{_prev:n,_curr:a}=this;t.updateCPURenderAttributes();const c=t.getFastBounds(),u=Math.max(Math.floor(c.left+240),1),l=Math.min(Math.floor(c.right+240),479),h=Math.max(Math.floor(180-c.top),1),d=Math.min(Math.floor(180-c.bottom),359);let p=0,f=0,m=0,g=0,b=0,y=0;const v=[0,0,0];for(let e=h;e<d;e++)for(let r=u;r<l;r++)if(v[0]=r-240,v[1]=180-e,t.isTouching(v)){const t=e*s+r,i=n[t]-a[t],o=a[t-1]-a[t+1],c=a[t-s]-a[t+s];p+=o*o,f+=o*c,m+=c*c,b+=o*i,g+=c*i,y++}let{u:w,v:T}=r(p,f,m,b,g),E=0;y&&(E=y,y/=256,w/=y,T/=y),e.motionAmount=Math.round(.02*E*Math.hypot(w,T)),e.motionAmount>100&&(e.motionAmount=100),e.motionAmount>o&&(e.motionDirection=i(T,w)),e.motionFrameNumber=this.frameNumber}}else e.motionAmount=e.motionDirection=-1}}},function(t,e){const n=180/Math.PI,r={u:0,v:0},i=function(t){return(t+270)%360-180};t.exports={motionVector:function(t,e,n,i,s){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:r;const a=e*e-t*n;if(a){const r=-(s*e-i*n),c=-(e*i-t*s),u=8/a;o.u=r*u,o.v=c*u}else{const r=(e+t)*(e+t)+(n+e)*(n+e);if(r){const a=-(s+i)*(8/r);o.u=(e+t)*a,o.v=(n+e)*a}else o.u=0,o.v=0}return o},scratchDegrees:i,scratchAtan2:function(t,e){return i(Math.atan2(t,e)*n)}}},function(t,e,n){const r=n(3),i=n(2),s=n(1),o=n(5),a=n(7),c=n(215),u=n(14),l=n(4),h=n(37),d=n(0),p=129,f=130,m=131,g=225,b=32,y=96,v=0,w=128,T=2,E=175,A=163,k=179,I=148,S=1,x=0,O=152,M=157,N=0,C=0,R=1,D=50,P=0,L=32,B={29:"color",30:"ultrasonic",32:"gyro",16:"touch",8:"mediumMotor",7:"largeMotor",126:"none",125:"none"},U={touch:0,color:1,ultrasonic:1,none:0},j={touch:"button",color:"brightness",ultrasonic:"distance"};class F{constructor(t,e,n){this._parent=t,this._index=e,this._type=n,this._direction=1,this._power=50,this._position=0,this._commandID=null,this._coastDelay=1e3}get type(){return this._type}set type(t){this._type=t}get direction(){return this._direction}set direction(t){this._direction=t<0?-1:1}get power(){return this._power}set power(t){this._power=t}get position(){return this._position}set position(t){let e=t[0]+256*t[1]+256*t[2]*256+256*t[3]*256*256;e>2147483647&&(e-=4294967296),this._position=e}turnOnFor(t){if(0===this._power)return;const e=this._portMask(this._index);let n=t,r=this._power*this._direction;const i=D;let s=[];s[0]=E,r<0&&(r*=-1,n*=-1);const o=n<0?256-r:r;n=Math.abs(n);let a=i,c=i,u=n-2*i;u<0&&(a=Math.floor(n/2),u=0,c=n-a);const l=this._runValues(u);s=s.concat([N,e,p,255&o,p,a]).concat(l.concat([p,c,R]));const h=this._parent.generateCommand(w,s);this._parent.send(h),this.coastAfter(t)}coastAfter(t){if(0===this._power)return;const e=a();this._commandID=e,setTimeout((()=>{this._commandID===e&&(this.coast(),this._commandID=null)}),t+this._coastDelay)}coast(){if(0===this._power)return;const t=this._parent.generateCommand(w,[A,N,this._portMask(this._index),C]);this._parent.send(t,!1)}_runValues(t){return t<32767?[f,255&t,t>>8&255]:[m,255&t,t>>8&255,t>>16&255,t>>24&255]}_portMask(t){return Math.pow(2,t)}}class z{constructor(t,e){this._runtime=t,this._runtime.on("PROJECT_STOP_ALL",this.stopAll.bind(this)),this._extensionId=e,this._sensorPorts=[],this._motorPorts=[],this._sensors={distance:0,brightness:0,buttons:[0,0,0,0]},this._motors=[null,null,null,null],this._pollingInterval=150,this._pollingIntervalID=null,this._pollingCounter=0,this._bt=null,this._runtime.registerPeripheralExtension(e,this),this._rateLimiter=new h(40),this.reset=this.reset.bind(this),this._onConnect=this._onConnect.bind(this),this._onMessage=this._onMessage.bind(this),this._pollValues=this._pollValues.bind(this)}get distance(){let t=this._sensors.distance>100?100:this._sensors.distance;return t=t<0?0:t,t=Math.round(100*t)/100,t}get brightness(){return this._sensors.brightness}motor(t){return this._motors[t]}isButtonPressed(t){return 1===this._sensors.buttons[t]}beep(t,e){const n=this.generateCommand(w,[I,S,p,2,f,t,t>>8,f,e,e>>8]);this.send(n)}stopAll(){this.stopAllMotors(),this.stopSound()}stopSound(){const t=this.generateCommand(w,[I,x]);this.send(t,!1)}stopAllMotors(){this._motors.forEach((t=>{t&&t.coast()}))}scan(){this._bt&&this._bt.disconnect(),this._bt=new c(this._runtime,this._extensionId,{majorDeviceClass:8,minorDeviceClass:1},this._onConnect,this.reset,this._onMessage)}connect(t){this._bt&&this._bt.connectPeripheral(t,"1234")}disconnect(){this._bt&&this._bt.disconnect(),this.reset()}reset(){this._sensorPorts=[],this._motorPorts=[],this._sensors={distance:0,brightness:0,buttons:[0,0,0,0]},this._motors=[null,null,null,null],this._pollingIntervalID&&(window.clearInterval(this._pollingIntervalID),this._pollingIntervalID=null)}isConnected(){let t=!1;return this._bt&&(t=this._bt.isConnected()),t}send(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.isConnected()?e&&!this._rateLimiter.okayToSend()?Promise.resolve():this._bt.sendMessage({message:u.uint8ArrayToBase64(t),encoding:"base64"}):Promise.resolve()}generateCommand(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=[];r[2]=0,r[3]=0,r[4]=t,r[5]=255&n,r[6]=n>>8&&255,r=r.concat(e);const i=r.length-2;return r[0]=255&i,r[1]=i>>8&&255,r}_onConnect(){this._pollingIntervalID=window.setInterval(this._pollValues,this._pollingInterval)}_pollValues(){if(!this.isConnected())return void window.clearInterval(this._pollingIntervalID);const t=[];let e=0,n=0;if(this._pollingCounter%20==0)t[0]=O,t[1]=p,t[2]=L,t[3]=y,t[4]=g,t[5]=b,e=33,this._updateDevices=!0;else{let r=0;for(let e=0;e<4;e++)"none"!==this._sensorPorts[e]&&(t[r+0]=M,t[r+1]=N,t[r+2]=e,t[r+3]=P,t[r+4]=U[this._sensorPorts[e]],t[r+5]=g,t[r+6]=4*n,r+=7),n++;for(let e=0;e<4;e++)t[r+0]=k,t[r+1]=N,t[r+2]=e,t[r+3]=g,t[r+4]=4*n,r+=5,n++;e=4*n}const r=this.generateCommand(v,t,e);this.send(r),this._pollingCounter++}_onMessage(t){const e=t.message,n=u.base64ToUint8Array(e);if(n[4]===T)if(this._updateDevices){for(let t=0;t<4;t++){const e=B[n[t+5]];this._sensorPorts[t]=e||"none"}for(let t=0;t<4;t++){const e=B[n[t+21]];this._motorPorts[t]=e||"none"}for(let t=0;t<4;t++){const e=this._motorPorts[t];"none"===e||this._motors[t]||(this._motors[t]=new F(this,t,e)),"none"===e&&this._motors[t]&&(this._motors[t]=null)}this._updateDevices=!1}else if(!this._sensorPorts.includes(void 0)&&!this._motorPorts.includes(void 0)){let t=5;for(let e=0;e<4;e++){const r=new Uint8Array([n[t],n[t+1],n[t+2],n[t+3]]).buffer,i=new DataView(r).getFloat32(0,!0);"button"===j[this._sensorPorts[e]]?this._sensors.buttons[e]=i||0:j[this._sensorPorts[e]]&&(this._sensors[j[this._sensorPorts[e]]]=i||0),t+=4}for(let e=0;e<4;e++){const r=[n[t],n[t+1],n[t+2],n[t+3]];this._motors[e]&&(this._motors[e].position=r),t+=4}}}}const V=["A","B","C","D"],G=["1","2","3","4"];class Y{static get EXTENSION_ID(){return"ev3"}constructor(t){this.runtime=t,this._peripheral=new z(this.runtime,Y.EXTENSION_ID),this._playNoteForPicker=this._playNoteForPicker.bind(this),this.runtime.on("PLAY_NOTE",this._playNoteForPicker)}getInfo(){return{id:Y.EXTENSION_ID,name:"LEGO EV3",blockIconURI:"data:image/svg+xml;base64, ",showStatusButton:!0,blocks:[{opcode:"motorTurnClockwise",text:o({id:"ev3.motorTurnClockwise",default:"motor [PORT] turn this way for [TIME] seconds",description:"turn a motor clockwise for some time"}),blockType:i.COMMAND,arguments:{PORT:{type:r.STRING,menu:"motorPorts",defaultValue:0},TIME:{type:r.NUMBER,defaultValue:1}}},{opcode:"motorTurnCounterClockwise",text:o({id:"ev3.motorTurnCounterClockwise",default:"motor [PORT] turn that way for [TIME] seconds",description:"turn a motor counter-clockwise for some time"}),blockType:i.COMMAND,arguments:{PORT:{type:r.STRING,menu:"motorPorts",defaultValue:0},TIME:{type:r.NUMBER,defaultValue:1}}},{opcode:"motorSetPower",text:o({id:"ev3.motorSetPower",default:"motor [PORT] set power [POWER] %",description:"set a motor's power to some value"}),blockType:i.COMMAND,arguments:{PORT:{type:r.STRING,menu:"motorPorts",defaultValue:0},POWER:{type:r.NUMBER,defaultValue:100}}},{opcode:"getMotorPosition",text:o({id:"ev3.getMotorPosition",default:"motor [PORT] position",description:"get the measured degrees a motor has turned"}),blockType:i.REPORTER,arguments:{PORT:{type:r.STRING,menu:"motorPorts",defaultValue:0}}},{opcode:"whenButtonPressed",text:o({id:"ev3.whenButtonPressed",default:"when button [PORT] pressed",description:"when a button connected to a port is pressed"}),blockType:i.HAT,arguments:{PORT:{type:r.STRING,menu:"sensorPorts",defaultValue:0}}},{opcode:"whenDistanceLessThan",text:o({id:"ev3.whenDistanceLessThan",default:"when distance < [DISTANCE]",description:"when the value measured by the distance sensor is less than some value"}),blockType:i.HAT,arguments:{DISTANCE:{type:r.NUMBER,defaultValue:5}}},{opcode:"whenBrightnessLessThan",text:o({id:"ev3.whenBrightnessLessThan",default:"when brightness < [DISTANCE]",description:"when value measured by brightness sensor is less than some value"}),blockType:i.HAT,arguments:{DISTANCE:{type:r.NUMBER,defaultValue:50}}},{opcode:"buttonPressed",text:o({id:"ev3.buttonPressed",default:"button [PORT] pressed?",description:"is a button on some port pressed?"}),blockType:i.BOOLEAN,arguments:{PORT:{type:r.STRING,menu:"sensorPorts",defaultValue:0}}},{opcode:"getDistance",text:o({id:"ev3.getDistance",default:"distance",description:"gets measured distance"}),blockType:i.REPORTER},{opcode:"getBrightness",text:o({id:"ev3.getBrightness",default:"brightness",description:"gets measured brightness"}),blockType:i.REPORTER},{opcode:"beep",text:o({id:"ev3.beepNote",default:"beep note [NOTE] for [TIME] secs",description:"play some note on EV3 for some time"}),blockType:i.COMMAND,arguments:{NOTE:{type:r.NOTE,defaultValue:60},TIME:{type:r.NUMBER,defaultValue:.5}}}],menus:{motorPorts:{acceptReporters:!0,items:this._formatMenu(V)},sensorPorts:{acceptReporters:!0,items:this._formatMenu(G)}}}}motorTurnClockwise(t){const e=s.toNumber(t.PORT);let n=1e3*s.toNumber(t.TIME);return n=l.clamp(n,0,15e3),new Promise((t=>{this._forEachMotor(e,(t=>{const e=this._peripheral.motor(t);e&&(e.direction=1,e.turnOnFor(n))})),setTimeout(t,n)}))}motorTurnCounterClockwise(t){const e=s.toNumber(t.PORT);let n=1e3*s.toNumber(t.TIME);return n=l.clamp(n,0,15e3),new Promise((t=>{this._forEachMotor(e,(t=>{const e=this._peripheral.motor(t);e&&(e.direction=-1,e.turnOnFor(n))})),setTimeout(t,n)}))}motorSetPower(t){const e=s.toNumber(t.PORT),n=l.clamp(s.toNumber(t.POWER),0,100);this._forEachMotor(e,(t=>{const e=this._peripheral.motor(t);e&&(e.power=n)}))}getMotorPosition(t){const e=s.toNumber(t.PORT);if(![0,1,2,3].includes(e))return;const n=this._peripheral.motor(e);let r=0;return n&&(r=l.wrapClamp(n.position,0,360)),r}whenButtonPressed(t){const e=s.toNumber(t.PORT);if([0,1,2,3].includes(e))return this._peripheral.isButtonPressed(e)}whenDistanceLessThan(t){const e=l.clamp(s.toNumber(t.DISTANCE),0,100);return this._peripheral.distance<e}whenBrightnessLessThan(t){const e=l.clamp(s.toNumber(t.DISTANCE),0,100);return this._peripheral.brightness<e}buttonPressed(t){const e=s.toNumber(t.PORT);if([0,1,2,3].includes(e))return this._peripheral.isButtonPressed(e)}getDistance(){return this._peripheral.distance}getBrightness(){return this._peripheral.brightness}_playNoteForPicker(t,e){e===this.getInfo().name&&this.beep({NOTE:t,TIME:.25})}beep(t){const e=l.clamp(s.toNumber(t.NOTE),47,99);let n=1e3*s.toNumber(t.TIME);if(n=l.clamp(n,0,3e3),0!==n)return new Promise((t=>{const r=440*Math.pow(2,(e-69+12)/12);this._peripheral.beep(r,n),setTimeout(t,n)}))}_forEachMotor(t,e){let n;switch(t){case 0:n=[0];break;case 1:n=[1];break;case 2:n=[2];break;case 3:n=[3];break;default:d.warn("Invalid motor ID: ".concat(t)),n=[]}for(const t of n)e(t)}_formatMenu(t){const e=[];for(let n=0;n<t.length;n++){const r={};r.text=t[n],r.value=n.toString(),e.push(r)}return e}}t.exports=Y},function(t,e,n){const r=n(58);t.exports=class extends r{constructor(t,e,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=arguments.length>5?arguments[5]:void 0;super(),this._socket=t.getScratchLinkSocket("BT"),this._socket.setOnOpen(this.requestPeripheral.bind(this)),this._socket.setOnError(this._handleRequestError.bind(this)),this._socket.setOnClose(this.handleDisconnectError.bind(this)),this._socket.setHandleMessage(this._handleMessage.bind(this)),this._sendMessage=this._socket.sendMessage.bind(this._socket),this._availablePeripherals={},this._connectCallback=r,this._connected=!1,this._characteristicDidChangeCallback=null,this._resetCallback=i,this._discoverTimeoutID=null,this._extensionId=e,this._peripheralOptions=n,this._messageCallback=s,this._runtime=t,this._socket.open()}requestPeripheral(){this._availablePeripherals={},this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID),this._discoverTimeoutID=window.setTimeout(this._handleDiscoverTimeout.bind(this),15e3),this.sendRemoteRequest("discover",this._peripheralOptions).catch((t=>this._handleRequestError(t)))}connectPeripheral(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const n={peripheralId:t};e&&(n.pin=e),this.sendRemoteRequest("connect",n).then((()=>{this._connected=!0,this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTED),this._connectCallback()})).catch((t=>{this._handleRequestError(t)}))}disconnect(){this._connected&&(this._connected=!1),this._socket.isOpen()&&this._socket.close(),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID),this._runtime.emit(this._runtime.constructor.PERIPHERAL_DISCONNECTED)}isConnected(){return this._connected}sendMessage(t){return this.sendRemoteRequest("send",t).catch((t=>{this.handleDisconnectError(t)}))}didReceiveCall(t,e){switch(t){case"didDiscoverPeripheral":this._availablePeripherals[e.peripheralId]=e,this._runtime.emit(this._runtime.constructor.PERIPHERAL_LIST_UPDATE,this._availablePeripherals),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID);break;case"userDidPickPeripheral":this._availablePeripherals[e.peripheralId]=e,this._runtime.emit(this._runtime.constructor.USER_PICKED_PERIPHERAL,this._availablePeripherals),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID);break;case"userDidNotPickPeripheral":this._runtime.emit(this._runtime.constructor.PERIPHERAL_SCAN_TIMEOUT),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID);break;case"didReceiveMessage":this._messageCallback(e);break;default:return"nah"}}handleDisconnectError(){this._connected&&(this.disconnect(),this._resetCallback&&this._resetCallback(),this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTION_LOST_ERROR,{message:"Scratch lost connection to",extensionId:this._extensionId}))}_handleRequestError(){this._runtime.emit(this._runtime.constructor.PERIPHERAL_REQUEST_ERROR,{message:"Scratch lost connection to",extensionId:this._extensionId})}_handleDiscoverTimeout(){this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID),this._runtime.emit(this._runtime.constructor.PERIPHERAL_SCAN_TIMEOUT)}}},function(t,e,n){const r=n(5),i=n(3),s=n(2),o=n(1),a="SPACE",c="LEFT",u="RIGHT",l="UP",h="DOWN",d={[a]:"space",[c]:"left arrow",[l]:"up arrow",[u]:"right arrow",[h]:"down arrow"};t.exports=class{constructor(t){this.runtime=t,this.frameToggle=!1,setInterval((()=>{this.frameToggle=!this.frameToggle}),this.runtime.currentStepTime),this.keyPressed=this.keyPressed.bind(this),this.runtime.on("KEY_PRESSED",this.keyPressed),this._clearkeyPressBuffer=this._clearkeyPressBuffer.bind(this),this.runtime.on("PROJECT_STOP_ALL",this._clearkeyPressBuffer),this.sequences={},this.keyPressBuffer=[]}get KEY_TEXT_SHORT(){return{[a]:r({id:"makeymakey.spaceKey",default:"space",description:"The space key on a computer keyboard."}),[c]:r({id:"makeymakey.leftArrowShort",default:"left",description:"Short name for the left arrow key on a computer keyboard."}),[l]:r({id:"makeymakey.upArrowShort",default:"up",description:"Short name for the up arrow key on a computer keyboard."}),[u]:r({id:"makeymakey.rightArrowShort",default:"right",description:"Short name for the right arrow key on a computer keyboard."}),[h]:r({id:"makeymakey.downArrowShort",default:"down",description:"Short name for the down arrow key on a computer keyboard."})}}get DEFAULT_SEQUENCES(){return["".concat(c," ").concat(l," ").concat(u),"".concat(u," ").concat(l," ").concat(c),"".concat(c," ").concat(u),"".concat(u," ").concat(c),"".concat(l," ").concat(h),"".concat(h," ").concat(l),"".concat(l," ").concat(u," ").concat(h," ").concat(c),"".concat(l," ").concat(c," ").concat(h," ").concat(u),"".concat(l," ").concat(l," ").concat(h," ").concat(h," ")+"".concat(c," ").concat(u," ").concat(c," ").concat(u)]}getInfo(){return{id:"makeymakey",name:"Makey Makey",blockIconURI:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHN0eWxlPi5zdDJ7ZmlsbDpyZWR9LnN0M3tmaWxsOiNlMGUwZTB9LnN0NHtmaWxsOm5vbmU7c3Ryb2tlOiM2NjY7c3Ryb2tlLXdpZHRoOi41O3N0cm9rZS1taXRlcmxpbWl0OjEwfTwvc3R5bGU+PHBhdGggZD0iTTM1IDI4SDVhMSAxIDAgMCAxLTEtMVYxMmMwLS42LjQtMSAxLTFoMzBjLjUgMCAxIC40IDEgMXYxNWMwIC41LS41IDEtMSAxeiIgZmlsbD0iI2ZmZiIgaWQ9IkxheWVyXzYiLz48ZyBpZD0iTGF5ZXJfNCI+PHBhdGggY2xhc3M9InN0MiIgZD0iTTQgMjVoMzJ2Mi43SDR6TTEzIDI0aC0yLjJhMSAxIDAgMCAxLTEtMXYtOS43YzAtLjYuNC0xIDEtMUgxM2MuNiAwIDEgLjQgMSAxVjIzYzAgLjYtLjUgMS0xIDF6Ii8+PHBhdGggY2xhc3M9InN0MiIgZD0iTTYuMSAxOS4zdi0yLjJjMC0uNS40LTEgMS0xaDkuN2MuNSAwIDEgLjUgMSAxdjIuMmMwIC41LS41IDEtMSAxSDcuMWExIDEgMCAwIDEtMS0xeiIvPjxjaXJjbGUgY2xhc3M9InN0MiIgY3g9IjIyLjgiIGN5PSIxOC4yIiByPSIzLjQiLz48Y2lyY2xlIGNsYXNzPSJzdDIiIGN4PSIzMC42IiBjeT0iMTguMiIgcj0iMy40Ii8+PHBhdGggY2xhc3M9InN0MiIgZD0iTTQuMiAyN2gzMS45di43SDQuMnoiLz48L2c+PGcgaWQ9IkxheWVyXzUiPjxjaXJjbGUgY2xhc3M9InN0MyIgY3g9IjIyLjgiIGN5PSIxOC4yIiByPSIyLjMiLz48Y2lyY2xlIGNsYXNzPSJzdDMiIGN4PSIzMC42IiBjeT0iMTguMiIgcj0iMi4zIi8+PHBhdGggY2xhc3M9InN0MyIgZD0iTTEyLjUgMjIuOWgtMS4yYy0uMyAwLS41LS4yLS41LS41VjE0YzAtLjMuMi0uNS41LS41aDEuMmMuMyAwIC41LjIuNS41djguNGMwIC4zLS4yLjUtLjUuNXoiLz48cGF0aCBjbGFzcz0ic3QzIiBkPSJNNy4yIDE4Ljd2LTEuMmMwLS4zLjItLjUuNS0uNWg4LjRjLjMgMCAuNS4yLjUuNXYxLjJjMCAuMy0uMi41LS41LjVINy43Yy0uMyAwLS41LS4yLS41LS41ek00IDI2aDMydjJINHoiLz48L2c+PGcgaWQ9IkxheWVyXzMiPjxwYXRoIGNsYXNzPSJzdDQiIGQ9Ik0zNS4yIDI3LjlINC44YTEgMSAwIDAgMS0xLTFWMTIuMWMwLS42LjUtMSAxLTFoMzAuNWMuNSAwIDEgLjQgMSAxVjI3YTEgMSAwIDAgMS0xLjEuOXoiLz48cGF0aCBjbGFzcz0ic3Q0IiBkPSJNMzUuMiAyNy45SDQuOGExIDEgMCAwIDEtMS0xVjEyLjFjMC0uNi41LTEgMS0xaDMwLjVjLjUgMCAxIC40IDEgMVYyN2ExIDEgMCAwIDEtMS4xLjl6Ii8+PC9nPjwvc3ZnPg==",blocks:[{opcode:"whenMakeyKeyPressed",text:r({id:"makeymakey.whenKeyPressed",default:"when [KEY] key pressed",description:"when a keyboard key is pressed"}),blockType:s.HAT,arguments:{KEY:{type:i.STRING,menu:"KEY",defaultValue:a}}},{opcode:"whenCodePressed",text:r({id:"makeymakey.whenKeysPressedInOrder",default:"when [SEQUENCE] pressed in order",description:"when a sequence of keyboard keys is pressed in a specific order"}),blockType:s.HAT,arguments:{SEQUENCE:{type:i.STRING,menu:"SEQUENCE",defaultValue:this.DEFAULT_SEQUENCES[0]}}}],menus:{KEY:{acceptReporters:!0,items:[{text:r({id:"makeymakey.spaceKey",default:"space",description:"The space key on a computer keyboard."}),value:a},{text:r({id:"makeymakey.upArrow",default:"up arrow",description:"The up arrow key on a computer keyboard."}),value:l},{text:r({id:"makeymakey.downArrow",default:"down arrow",description:"The down arrow key on a computer keyboard."}),value:h},{text:r({id:"makeymakey.rightArrow",default:"right arrow",description:"The right arrow key on a computer keyboard."}),value:u},{text:r({id:"makeymakey.leftArrow",default:"left arrow",description:"The left arrow key on a computer keyboard."}),value:c},{text:"w",value:"w"},{text:"a",value:"a"},{text:"s",value:"s"},{text:"d",value:"d"},{text:"f",value:"f"},{text:"g",value:"g"}]},SEQUENCE:{acceptReporters:!0,items:this.buildSequenceMenu(this.DEFAULT_SEQUENCES)}}}}buildSequenceMenu(t){return t.map((t=>this.getMenuItemForSequenceString(t)))}getMenuItemForSequenceString(t){let e=t.split(" ");return e=e.map((t=>this.KEY_TEXT_SHORT[t])),{text:e.join(" "),value:t}}whenMakeyKeyPressed(t,e){let n=t.KEY;d[t.KEY]&&(n=d[t.KEY]);return e.ioQuery("keyboard","getKeyIsDown",[n])&&this.frameToggle}keyPressed(t){t=(t=t.split(" ")[0]).toUpperCase(),this.keyPressBuffer.push(t),this.keyPressBuffer.length>100&&this.keyPressBuffer.shift();for(const t in this.sequences){const e=this.sequences[t].array;if(this.keyPressBuffer.length<e.length)continue;let n=!1;const r=this.keyPressBuffer.slice(-1*e.length);for(let t=0;t<e.length;t++)e[t]!==r[t]&&(n=!0);n||(this.sequences[t].completed=!0,setTimeout((()=>{this.sequences[t].completed=!1}),100))}}_clearkeyPressBuffer(){this.keyPressBuffer=[]}addSequence(t,e){Object.prototype.hasOwnProperty.call(this.sequences,t)||(this.sequences[t]={array:e,completed:!1})}whenCodePressed(t){const e=o.toString(t.SEQUENCE).toUpperCase(),n=e.split(" ");if(!(n.length<2))return this.addSequence(e,n),this.sequences[e].completed}}},function(t,e,n){const r=n(3),i=n(2),s=n(1),o=n(5),a=n(20),c=n(28),u=n(14),l=n(4),h=n(37),d=n(0),p="00001623-1212-efde-1623-785feabcd123",f="00001624-1212-efde-1623-785feabcd123",m=100,g=20,b=20,y=21,v=23,w=37,T=38,E=39,A=40,k=1,I=2,S=4,x={A:55,B:56,C:1,D:2},O={A:0,B:1,C:2,D:3};let M=O;const N="any",C="none",R="red",D="blue",P="green",L="yellow",B="white",U="black",j={[C]:255,[R]:9,[D]:3,[P]:5,[L]:7,[B]:10,[U]:0},F={HUB_PROPERTIES:1,HUB_ACTIONS:2,HUB_ALERTS:3,HUB_ATTACHED_IO:4,ERROR:5,PORT_INPUT_FORMAT_SETUP_SINGLE:65,PORT_INPUT_FORMAT_SETUP_COMBINED:66,PORT_INFORMATION:67,PORT_MODEINFORMATION:68,PORT_VALUE:69,PORT_VALUE_COMBINED:70,PORT_INPUT_FORMAT:71,PORT_INPUT_FORMAT_COMBINED:72,OUTPUT:129,PORT_FEEDBACK:130},z=3,V=5,G=1,Y=7,H=11,W=81,K=16,q=1,Q=0,X=127,Z=0,J=1,_=0,$=0,tt=1,et=0,nt=2,rt=0,it=0,st=1,ot=2,at=3,ct=function(t){const e=new ArrayBuffer(4),n=new DataView(e);return n.setInt32(0,t),[n.getInt8(3),n.getInt8(2),n.getInt8(1),n.getInt8(0)]},ut=function(t){const e=Uint8Array.from(t);return new DataView(e.buffer).getInt32(0,!0)};class lt{constructor(t,e){this._parent=t,this._index=e,this._direction=1,this._power=50,this._position=0,this._status=it,this._pendingDurationTimeoutId=null,this._pendingDurationTimeoutStartTime=null,this._pendingDurationTimeoutDelay=null,this._pendingRotationDestination=null,this._pendingRotationPromise=null,this.turnOff=this.turnOff.bind(this)}get direction(){return this._direction}set direction(t){this._direction=t<0?-1:1}get power(){return this._power}set power(t){this._power=0===t?0:l.scale(t,1,100,10,100)}get position(){return this._position}set position(t){this._position=t}get status(){return this._status}set status(t){this._clearRotationState(),this._clearDurationTimeout(),this._status=t}get pendingDurationTimeoutStartTime(){return this._pendingDurationTimeoutStartTime}get pendingDurationTimeoutDelay(){return this._pendingDurationTimeoutDelay}get pendingRotationDestination(){return this._pendingRotationDestination}get pendingRotationPromise(){return this._pendingRotationPromise}set pendingRotationPromise(t){this._pendingRotationPromise=t}_turnOn(){const t=this._parent.generateOutputCommand(this._index,K,Y,[this.power*this.direction,l.clamp(this.power+10,0,100),Z]);this._parent.send(f,t)}turnOnForever(){this.status=st,this._turnOn()}turnOnFor(t){t=Math.max(0,t),this.status=ot,this._turnOn(),this._setNewDurationTimeout(this.turnOff,t)}turnOnForDegrees(t,e){t=Math.max(0,t);const n=this._parent.generateOutputCommand(this._index,K^q,H,[...ct(t),this.power*this.direction*e,l.clamp(this.power+10,0,100),X,Z]);this.status=at,this._pendingRotationDestination=this.position+t*this.direction*e,this._parent.send(f,n)}turnOff(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this._parent.generateOutputCommand(this._index,K,G,[Q]);this.status=it,this._parent.send(f,e,t)}_clearDurationTimeout(){null!==this._pendingDurationTimeoutId&&(clearTimeout(this._pendingDurationTimeoutId),this._pendingDurationTimeoutId=null,this._pendingDurationTimeoutStartTime=null,this._pendingDurationTimeoutDelay=null)}_setNewDurationTimeout(t,e){this._clearDurationTimeout();const n=setTimeout((()=>{this._pendingDurationTimeoutId===n&&(this._pendingDurationTimeoutId=null,this._pendingDurationTimeoutStartTime=null,this._pendingDurationTimeoutDelay=null),t()}),e);this._pendingDurationTimeoutId=n,this._pendingDurationTimeoutStartTime=Date.now(),this._pendingDurationTimeoutDelay=e}_clearRotationState(){null!==this._pendingRotationPromise&&(this._pendingRotationPromise(),this._pendingRotationPromise=null),this._pendingRotationDestination=null}}class ht{constructor(t,e){this._runtime=t,this._runtime.on("PROJECT_STOP_ALL",this.stopAll.bind(this)),this._extensionId=e,this._ports=[],this._motors=[],this._sensors={tiltX:0,tiltY:0,color:C,previousColor:C},this._colorSamples=[],this._ble=null,this._runtime.registerPeripheralExtension(e,this),this._rateLimiter=new h(g),this._pingDeviceId=null,this.reset=this.reset.bind(this),this._onConnect=this._onConnect.bind(this),this._onMessage=this._onMessage.bind(this),this._pingDevice=this._pingDevice.bind(this)}get tiltX(){return this._sensors.tiltX}get tiltY(){return this._sensors.tiltY}get color(){return this._sensors.color}get previousColor(){return this._sensors.previousColor}boostColorForIndex(t){return Object.keys(j).find((e=>j[e]===t))||C}motor(t){return this._motors[t]}stopAllMotors(){this._motors.forEach((t=>{t&&t.turnOff(!1)}))}setLED(t){const e=[t>>16&255,t>>8&255,255&t],n=this.generateOutputCommand(this._ports.indexOf(v),K^q,W,[tt,...e]);return this.send(f,n)}setLEDMode(){const t=this.generateInputCommand(this._ports.indexOf(v),tt,0,!1);return this.send(f,t)}stopAll(){this.isConnected()&&this.stopAllMotors()}scan(){this._ble&&this._ble.disconnect(),this._ble=new c(this._runtime,this._extensionId,{filters:[{services:[p],manufacturerData:{919:{dataPrefix:[0,64],mask:[0,255]}}}],optionalServices:[]},this._onConnect,this.reset)}connect(t){this._ble&&this._ble.connectPeripheral(t)}disconnect(){this._ble&&this._ble.disconnect(),this.reset()}reset(){this._ports=[],this._motors=[],this._sensors={tiltX:0,tiltY:0,color:C,previousColor:C},this._pingDeviceId&&(window.clearInterval(this._pingDeviceId),this._pingDeviceId=null)}isConnected(){let t=!1;return this._ble&&(t=this._ble.isConnected()),t}send(t,e){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.isConnected()?n&&!this._rateLimiter.okayToSend()?Promise.resolve():this._ble.write(p,t,u.uint8ArrayToBase64(e),"base64"):Promise.resolve()}generateOutputCommand(t,e,n,r){const i=[0,F.OUTPUT,t,e,n,...r];return i.unshift(i.length+1),i}generateInputCommand(t,e,n,r){const i=[0,F.PORT_INPUT_FORMAT_SETUP_SINGLE,t,e].concat(ct(n)).concat([r]);return i.unshift(i.length+1),i}_onConnect(){this._ble.startNotifications(p,f,this._onMessage),this._pingDeviceId=window.setInterval(this._pingDevice,5e3),setTimeout((()=>{const t=[0,F.HUB_PROPERTIES,z,V];t.unshift(t.length+1),this.send(f,t,!1)}),500)}_onMessage(t){const e=u.base64ToUint8Array(t),n=e[2],r=e[3];switch(n){case F.HUB_PROPERTIES:switch(e[3]){case z:{const t=ut([36,2,0,16]);ut(e.slice(5,e.length))<t?(M=x,d.info("Move Hub firmware older than version 1.0.00.0224 detected. Using old port mapping.")):M=O;break}}break;case F.HUB_ATTACHED_IO:{const t=e[4],n=e[5];switch(t){case J:this._registerSensorOrMotor(r,n);break;case _:this._clearPort(r)}break}case F.PORT_VALUE:{const t=this._ports[r];switch(t){case A:this._sensors.tiltX=e[4],this._sensors.tiltY=e[5];break;case w:this._colorSamples.unshift(e[4]),this._colorSamples.length>5?(this._colorSamples.pop(),this._colorSamples.every(((t,e,n)=>t===n[0]))?(this._sensors.previousColor=this._sensors.color,this._sensors.color=this.boostColorForIndex(this._colorSamples[0])):this._sensors.color=C):this._sensors.color=C;break;case T:case E:this.motor(r).position=ut(e.slice(4,8));break;case y:case b:case v:break;default:d.warn("Unknown sensor value! Type: ".concat(t))}break}case F.PORT_FEEDBACK:{const t=e[4],n=this.motor(r);if(n){!(t&k)&&t&(I^S)&&n.status===at&&(n.status=it)}break}case F.ERROR:d.warn("Error reported by hub: ".concat(e))}}_pingDevice(){this._ble.read(p,f,!1)}_registerSensorOrMotor(t,e){this._ports[t]=e,e!==E&&e!==T||(this._motors[t]=new lt(this,t));let n=null,r=1;switch(e){case E:case T:n=nt;break;case w:n=et,r=0;break;case v:n=tt,this.setLEDMode(),this.setLED(255);break;case A:n=$;break;default:n=rt}const i=this.generateInputCommand(t,n,r,!0);this.send(f,i)}_clearPort(t){const e=this._ports[t];e===A&&(this._sensors.tiltX=this._sensors.tiltY=0),e===w&&(this._sensors.color=C),this._ports[t]="none",this._motors[t]=null}}const dt="A",pt="B",ft="C",mt="D",gt="AB",bt="ABCD",yt="this way",vt="that way",wt="reverse",Tt="up",Et="down",At="left",kt="right",It="any";class St{static get EXTENSION_ID(){return"boost"}static get TILT_THRESHOLD(){return 15}constructor(t){this.runtime=t,this._peripheral=new ht(this.runtime,St.EXTENSION_ID)}getInfo(){return{id:St.EXTENSION_ID,name:"BOOST",blockIconURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACpQTFRF////fIel5ufolZ62/2YavsPS+YZOkJmy9/j53+Hk6+zs6N/b6dfO////tDhMHAAAAA50Uk5T/////////////////wBFwNzIAAAA6ElEQVR42uzX2w6DIBAEUGDVtlr//3dLaLwgiwUd2z7MJPJg5EQWiGhGcAxBggQJEiT436CIfqXJPTn3MKNYYMSDFpoAmp24OaYgvwKnFgL2zvVTCwHrMoMi+nUQLFthaNCCa0iwclLkDgYVsQp0mzxuqXgK1MRzoCLWgkPXNN2wI/q6Kvt7u/cX0HtejN8x2sXpnpb8J8D3b0Keuhh3X975M+i0xNVbg3s1TIasgK21bQyGO+s2PykaGMYbge8KrNrssvkOWDXkErB8UuBHETjoYLkKBA8ZfuDkbwVBggQJEiR4MC8BBgDTtMZLx2nFCQAAAABJRU5ErkJggg==",showStatusButton:!0,blocks:[{opcode:"motorOnFor",text:o({id:"boost.motorOnFor",default:"turn motor [MOTOR_ID] for [DURATION] seconds",description:"turn a motor on for some time"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:dt},DURATION:{type:r.NUMBER,defaultValue:1}}},{opcode:"motorOnForRotation",text:o({id:"boost.motorOnForRotation",default:"turn motor [MOTOR_ID] for [ROTATION] rotations",description:"turn a motor on for rotation"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:dt},ROTATION:{type:r.NUMBER,defaultValue:1}}},{opcode:"motorOn",text:o({id:"boost.motorOn",default:"turn motor [MOTOR_ID] on",description:"turn a motor on indefinitely"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:dt}}},{opcode:"motorOff",text:o({id:"boost.motorOff",default:"turn motor [MOTOR_ID] off",description:"turn a motor off"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:dt}}},{opcode:"setMotorPower",text:o({id:"boost.setMotorPower",default:"set motor [MOTOR_ID] speed to [POWER] %",description:"set the motor's speed without turning it on"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:bt},POWER:{type:r.NUMBER,defaultValue:100}}},{opcode:"setMotorDirection",text:o({id:"boost.setMotorDirection",default:"set motor [MOTOR_ID] direction [MOTOR_DIRECTION]",description:"set the motor's turn direction without turning it on"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:dt},MOTOR_DIRECTION:{type:r.STRING,menu:"MOTOR_DIRECTION",defaultValue:yt}}},{opcode:"getMotorPosition",text:o({id:"boost.getMotorPosition",default:"motor [MOTOR_REPORTER_ID] position",description:"the position returned by the motor"}),blockType:i.REPORTER,arguments:{MOTOR_REPORTER_ID:{type:r.STRING,menu:"MOTOR_REPORTER_ID",defaultValue:dt}}},{opcode:"whenColor",text:o({id:"boost.whenColor",default:"when [COLOR] brick seen",description:"check for when color"}),blockType:i.HAT,arguments:{COLOR:{type:r.STRING,menu:"COLOR",defaultValue:N}}},{opcode:"seeingColor",text:o({id:"boost.seeingColor",default:"seeing [COLOR] brick?",description:"is the color sensor seeing a certain color?"}),blockType:i.BOOLEAN,arguments:{COLOR:{type:r.STRING,menu:"COLOR",defaultValue:N}}},{opcode:"whenTilted",text:o({id:"boost.whenTilted",default:"when tilted [TILT_DIRECTION_ANY]",description:"check when tilted in a certain direction"}),func:"isTilted",blockType:i.HAT,arguments:{TILT_DIRECTION_ANY:{type:r.STRING,menu:"TILT_DIRECTION_ANY",defaultValue:It}}},{opcode:"getTiltAngle",text:o({id:"boost.getTiltAngle",default:"tilt angle [TILT_DIRECTION]",description:"the angle returned by the tilt sensor"}),blockType:i.REPORTER,arguments:{TILT_DIRECTION:{type:r.STRING,menu:"TILT_DIRECTION",defaultValue:Tt}}},{opcode:"setLightHue",text:o({id:"boost.setLightHue",default:"set light color to [HUE]",description:"set the LED color"}),blockType:i.COMMAND,arguments:{HUE:{type:r.NUMBER,defaultValue:50}}}],menus:{MOTOR_ID:{acceptReporters:!0,items:[{text:"A",value:dt},{text:"B",value:pt},{text:"C",value:ft},{text:"D",value:mt},{text:"AB",value:gt},{text:"ABCD",value:bt}]},MOTOR_REPORTER_ID:{acceptReporters:!0,items:[{text:"A",value:dt},{text:"B",value:pt},{text:"C",value:ft},{text:"D",value:mt}]},MOTOR_DIRECTION:{acceptReporters:!0,items:[{text:o({id:"boost.motorDirection.forward",default:"this way",description:"label for forward element in motor direction menu for LEGO Boost extension"}),value:yt},{text:o({id:"boost.motorDirection.backward",default:"that way",description:"label for backward element in motor direction menu for LEGO Boost extension"}),value:vt},{text:o({id:"boost.motorDirection.reverse",default:"reverse",description:"label for reverse element in motor direction menu for LEGO Boost extension"}),value:wt}]},TILT_DIRECTION:{acceptReporters:!0,items:[{text:o({id:"boost.tiltDirection.up",default:"up",description:"label for up element in tilt direction menu for LEGO Boost extension"}),value:Tt},{text:o({id:"boost.tiltDirection.down",default:"down",description:"label for down element in tilt direction menu for LEGO Boost extension"}),value:Et},{text:o({id:"boost.tiltDirection.left",default:"left",description:"label for left element in tilt direction menu for LEGO Boost extension"}),value:At},{text:o({id:"boost.tiltDirection.right",default:"right",description:"label for right element in tilt direction menu for LEGO Boost extension"}),value:kt}]},TILT_DIRECTION_ANY:{acceptReporters:!0,items:[{text:o({id:"boost.tiltDirection.up",default:"up"}),value:Tt},{text:o({id:"boost.tiltDirection.down",default:"down"}),value:Et},{text:o({id:"boost.tiltDirection.left",default:"left"}),value:At},{text:o({id:"boost.tiltDirection.right",default:"right"}),value:kt},{text:o({id:"boost.tiltDirection.any",default:"any",description:"label for any element in tilt direction menu for LEGO Boost extension"}),value:It}]},COLOR:{acceptReporters:!0,items:[{text:o({id:"boost.color.red",default:"red",description:"the color red"}),value:R},{text:o({id:"boost.color.blue",default:"blue",description:"the color blue"}),value:D},{text:o({id:"boost.color.green",default:"green",description:"the color green"}),value:P},{text:o({id:"boost.color.yellow",default:"yellow",description:"the color yellow"}),value:L},{text:o({id:"boost.color.white",default:"white",desription:"the color white"}),value:B},{text:o({id:"boost.color.black",default:"black",description:"the color black"}),value:U},{text:o({id:"boost.color.any",default:"any color",description:"any color"}),value:N}]}}}}motorOnFor(t){let e=1e3*s.toNumber(t.DURATION);return e=l.clamp(e,0,15e3),new Promise((n=>{this._forEachMotor(t.MOTOR_ID,(t=>{const n=this._peripheral.motor(t);n&&n.turnOnFor(e)})),setTimeout(n,e)}))}motorOnForRotation(t){let e=360*s.toNumber(t.ROTATION);const n=Math.sign(e);e=Math.abs(l.clamp(e,-36e4,36e4));const r=[];this._forEachMotor(t.MOTOR_ID,(t=>{r.push(t)}));const i=r.map((t=>{const r=this._peripheral.motor(t);return r?0===r.power?Promise.resolve():new Promise((t=>{r.turnOnForDegrees(e,n),r.pendingRotationPromise=t})):null}));return Promise.all(i).then((()=>{}))}motorOn(t){return this._forEachMotor(t.MOTOR_ID,(t=>{const e=this._peripheral.motor(t);e&&e.turnOnForever()})),new Promise((t=>{window.setTimeout((()=>{t()}),m)}))}motorOff(t){return this._forEachMotor(t.MOTOR_ID,(t=>{const e=this._peripheral.motor(t);e&&e.turnOff()})),new Promise((t=>{window.setTimeout((()=>{t()}),m)}))}setMotorPower(t){return this._forEachMotor(t.MOTOR_ID,(e=>{const n=this._peripheral.motor(e);if(n)switch(n.power=l.clamp(s.toNumber(t.POWER),0,100),n.status){case st:n.turnOnForever();break;case ot:n.turnOnFor(n.pendingDurationTimeoutStartTime+n.pendingDurationTimeoutDelay-Date.now())}})),new Promise((t=>{window.setTimeout((()=>{t()}),m)}))}setMotorDirection(t){return this._forEachMotor(t.MOTOR_ID,(e=>{const n=this._peripheral.motor(e);if(n){switch(t.MOTOR_DIRECTION){case yt:n.direction=1;break;case vt:n.direction=-1;break;case wt:n.direction=-n.direction;break;default:d.warn("Unknown motor direction in setMotorDirection: ".concat(t.DIRECTION))}if(n)switch(n.status){case st:n.turnOnForever();break;case ot:n.turnOnFor(n.pendingDurationTimeoutStartTime+n.pendingDurationTimeoutDelay-Date.now())}}})),new Promise((t=>{window.setTimeout((()=>{t()}),m)}))}getMotorPosition(t){let e=null;switch(t.MOTOR_REPORTER_ID){case dt:e=M.A;break;case pt:e=M.B;break;case ft:e=M.C;break;case mt:e=M.D;break;default:return d.warn("Asked for a motor position that doesnt exist!"),!1}if(null!==e&&this._peripheral.motor(e)){let t=this._peripheral.motor(e).position;return e===M.A&&(t*=-1),l.wrapClamp(t,0,360)}return 0}_forEachMotor(t,e){let n;switch(t){case dt:n=[M.A];break;case pt:n=[M.B];break;case ft:n=[M.C];break;case mt:n=[M.D];break;case gt:n=[M.A,M.B];break;case bt:n=[M.A,M.B,M.C,M.D];break;default:d.warn("Invalid motor ID: ".concat(t)),n=[]}for(const t of n)e(t)}whenTilted(t){return this._isTilted(t.TILT_DIRECTION_ANY)}isTilted(t){return this._isTilted(t.TILT_DIRECTION_ANY)}getTiltAngle(t){return this._getTiltAngle(t.TILT_DIRECTION)}_isTilted(t){return t===It?Math.abs(this._peripheral.tiltX)>=St.TILT_THRESHOLD||Math.abs(this._peripheral.tiltY)>=St.TILT_THRESHOLD:this._getTiltAngle(t)>=St.TILT_THRESHOLD}_getTiltAngle(t){switch(t){case Tt:return this._peripheral.tiltY>90?256-this._peripheral.tiltY:-this._peripheral.tiltY;case Et:return this._peripheral.tiltY>90?this._peripheral.tiltY-256:this._peripheral.tiltY;case At:return this._peripheral.tiltX>90?this._peripheral.tiltX-256:this._peripheral.tiltX;case kt:return this._peripheral.tiltX>90?256-this._peripheral.tiltX:-this._peripheral.tiltX;default:d.warn("Unknown tilt direction in _getTiltAngle: ".concat(t))}}whenColor(t){return t.COLOR===N?this._peripheral.color!==C&&this._peripheral.color!==this._peripheral.previousColor:t.COLOR===this._peripheral.color}seeingColor(t){return t.COLOR===N?this._peripheral.color!==C:t.COLOR===this._peripheral.color}setLightHue(t){let e=s.toNumber(t.HUE);e=l.wrapClamp(e,0,100);const n=360*e/100,r=a.hsvToRgb({h:n,s:1,v:1}),i=a.rgbToDecimal(r);return this._peripheral._led=e,this._peripheral.setLED(i),new Promise((t=>{window.setTimeout((()=>{t()}),m)}))}}t.exports=St},function(t,e,n){const r=n(3),i=n(2),s=n(0),o=n(5),a=n(4),c=n(28),u=n(219),l=n(220),h={service:"d91714ef-28b9-4f91-ba16-f0d9a604f112",commandChar:"f4bf14a6-c7d5-4b6d-8aa8-df1a7c83adcb",responseChar:"b41e6675-a329-40e0-aa01-44d2f444babe"},d="Force and Acceleration extension stopped receiving data",p=1,f=2,m=3,g=4,b=5,y=6,v=7;class w{constructor(t,e){this._runtime=t,this._ble=null,this._device=null,this._runtime.registerPeripheralExtension(e,this),this._extensionId=e,this._sensors={force:0,accelerationX:0,accelerationY:0,accelerationZ:0,spinSpeedX:0,spinSpeedY:0,spinSpeedZ:0},this._timeoutID=null,this.reset=this.reset.bind(this),this._onConnect=this._onConnect.bind(this)}scan(){this._ble&&this._ble.disconnect(),this._ble=new c(this._runtime,this._extensionId,{filters:[{namePrefix:"GDX-FOR"}],optionalServices:[h.service]},this._onConnect,this.reset)}connect(t){this._ble&&this._ble.connectPeripheral(t)}disconnect(){this._ble&&this._ble.disconnect(),this.reset()}reset(){this._sensors={force:0,accelerationX:0,accelerationY:0,accelerationZ:0,spinSpeedX:0,spinSpeedY:0,spinSpeedZ:0},this._timeoutID&&(window.clearInterval(this._timeoutID),this._timeoutID=null)}isConnected(){let t=!1;return this._ble&&(t=this._ble.isConnected()),t}_onConnect(){const t=new l(this._ble,h);u.createDevice(t,{open:!0,startMeasurements:!1}).then((t=>{this._device=t,this._device.keepValues=!1,this._device.sensors.forEach((t=>{t.setEnabled(!0)})),this._device.on("measurements-started",(()=>{this._device.sensors.filter((t=>t.enabled)).forEach((t=>{t.on("value-changed",(t=>{this._onSensorValueChanged(t)}))})),this._timeoutID=window.setInterval((()=>this._ble.handleDisconnectError(d)),4500)})),this._device.start(80)}))}_onSensorValueChanged(t){switch(t.number){case p:this._sensors.force=a.clamp(2*t.value,-100,100);break;case f:this._sensors.accelerationX=t.value;break;case m:this._sensors.accelerationY=t.value;break;case g:this._sensors.accelerationZ=t.value;break;case b:this._sensors.spinSpeedX=this._spinSpeedFromGyro(t.value);break;case y:this._sensors.spinSpeedY=this._spinSpeedFromGyro(t.value);break;case v:this._sensors.spinSpeedZ=this._spinSpeedFromGyro(t.value)}window.clearInterval(this._timeoutID),this._timeoutID=window.setInterval((()=>this._ble.handleDisconnectError(d)),4500)}_spinSpeedFromGyro(t){const e=1e3/this._runtime.currentStepTime;return t=a.radToDeg(t),t/=e,t*=-1}getForce(){return this._sensors.force}getTiltFrontBack(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=this.getAccelerationX(),n=this.getAccelerationY(),r=this.getAccelerationZ();let i=n*n+r*r;return i=Math.sqrt(i),i<.35?i=e<0?90:-90:(i=e/i,i=Math.atan(i),i=-1*a.radToDeg(i)),t&&(i*=-1),i}getTiltLeftRight(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=this.getAccelerationX(),n=this.getAccelerationY(),r=this.getAccelerationZ();let i=e*e+r*r;return i=Math.sqrt(i),i<.35?i=n<0?90:-90:(i=n/i,i=Math.atan(i),i=-1*a.radToDeg(i)),t&&(i*=-1),i}getAccelerationX(){return this._sensors.accelerationX}getAccelerationY(){return this._sensors.accelerationY}getAccelerationZ(){return this._sensors.accelerationZ}getSpinSpeedX(){return this._sensors.spinSpeedX}getSpinSpeedY(){return this._sensors.spinSpeedY}getSpinSpeedZ(){return this._sensors.spinSpeedZ}}const T="pushed",E="pulled",A="shaken",k="started falling",I="turned face up",S="turned face down",x="front",O="back",M="left",N="right",C="any",R="x",D="y",P="z";class L{static get EXTENSION_NAME(){return"Force and Acceleration"}static get EXTENSION_ID(){return"gdxfor"}get AXIS_MENU(){return[{text:"x",value:R},{text:"y",value:D},{text:"z",value:P}]}get TILT_MENU(){return[{text:o({id:"gdxfor.tiltDirectionMenu.front",default:"front",description:"label for front element in tilt direction picker for gdxfor extension"}),value:x},{text:o({id:"gdxfor.tiltDirectionMenu.back",default:"back",description:"label for back element in tilt direction picker for gdxfor extension"}),value:O},{text:o({id:"gdxfor.tiltDirectionMenu.left",default:"left",description:"label for left element in tilt direction picker for gdxfor extension"}),value:M},{text:o({id:"gdxfor.tiltDirectionMenu.right",default:"right",description:"label for right element in tilt direction picker for gdxfor extension"}),value:N}]}get TILT_MENU_ANY(){return[...this.TILT_MENU,{text:o({id:"gdxfor.tiltDirectionMenu.any",default:"any",description:"label for any direction element in tilt direction picker for gdxfor extension"}),value:C}]}get PUSH_PULL_MENU(){return[{text:o({id:"gdxfor.pushed",default:"pushed",description:"the force sensor was pushed inward"}),value:T},{text:o({id:"gdxfor.pulled",default:"pulled",description:"the force sensor was pulled outward"}),value:E}]}get GESTURE_MENU(){return[{text:o({id:"gdxfor.shaken",default:"shaken",description:"the sensor was shaken"}),value:A},{text:o({id:"gdxfor.startedFalling",default:"started falling",description:"the sensor started free falling"}),value:k},{text:o({id:"gdxfor.turnedFaceUp",default:"turned face up",description:"the sensor was turned to face up"}),value:I},{text:o({id:"gdxfor.turnedFaceDown",default:"turned face down",description:"the sensor was turned to face down"}),value:S}]}constructor(t){this.runtime=t,this._peripheral=new w(this.runtime,L.EXTENSION_ID)}getInfo(){return{id:L.EXTENSION_ID,name:L.EXTENSION_NAME,blockIconURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAABGdBTUEAALGPC/xhBQAACCNJREFUeAHtnGtsFFUUgM+dfXbbbbcWaKHSFgrlkWgkJCb6A4kmJfiHIBYBpcFfRg1GEkmEVAvhFYw/TExMxGoICAECiZEIIUQCiiT4gh+KILRQCi2ENIV2t/ue6zl3u2Upu4XuzO4csCe587iPmXO/OWfunTszV4ABWfflQU+0p+9bTcLzEmS5gUPlvagAcVMXcMpnK1u+evW8QLYKaNkWpHKxnt6dQsqFjxo80p10Jt1vx7t30n62Ys+2IJUTUpDlqUNomgYutwsjhZFD5r6slBAOhUHX9YTe6D1GTmrIAhFeBZ2c4JFCpBiggmwlBR7pTGLUewxZYBIUWV7yqgb7g8lotuukt5ihqyELHCSEbusk931ExMxbjSkWSNxEyr3vysxZLFHWnDuT0CtFV6OKmmOBRrV4hMubZoGmMZA6lHTfgsLeHnBEIiCxUY86XRDw+sBfOgZ0m820U5lxIFYAncF+GNvVDo5QaLBu1ClyYTyF4tvd8lZltQgXFA6mW73BxoVt0ShUXG2VCp4QQdDEFqez4Bm7p7gaO0of422r3x4Ji/KrbdIexu4SE2FjgWO6OkCLx6gt6gxOiNV92tiY+ni1Ye1nu7dpQfk35ikru9EBN6unsEDIwgLJPQv8dwCfT3WPt+iFIfAUqM3vL7vpjmuz0KX1gkAfOMN33dxKkjwA9vsTDIS8uubdBZcyAWlqWtohQbRSuru/L1O2vMazAGiLxRKVFqDgDEdAaHCN0kU8Ply2vKWxABhzJZ5ipC6qHlRzfJxVz99S49GdYQEw7PYkuAmokZJ6fumlQUqiNpVSQ56i9JnyHMsCYMRdADGHk0ZyHM1b976XicH0rXtWYR57FPNSGQ7CAiCBCJQ8oXhI0FdmBiPfVnl9ZZmz5DmFDcA+HwIUOEYMcjL2+e57PbBp04HxONI4ifIEKC8TYQMwhs+7IU+hwBFOYQvB5qF8grbwJnRfQXnIhbkIG4AExF+ScE00w0X3AZLwisrDyH1JH1YAA8UlIG029FRZsu6TPfVJiIltWYIjMTLgLUlGs1izeRYmGtS383t9wnu7G2J6fH/Tln2LNUdExGLxvZSOQ1qCS/+P9CFhBZAUuj12PHgCvRJHZ7w4EnhYjya6hXGHQ2Jaxj4ilbVC2AFEUNBVXSdKb3WC29+rmISKiqFn7ARBadyEHUACFHM64VZlDTdWafVh1Yik1ZB5JEsLJGaVtosw37ld4TscWQHX4+oRWO1zWrAEWCR6oMnTCEXijmI1234MVvsPgV+WcmKndGHpwlNtZwbhkZYEkuI4CkuAXfpk0HGAPym0TXEchaUL39Br4JvQeljk+lwxOxBeCRQ3UrFHI+AMBsEV6gcnhlwIS4BU0RORV1V42EqnwnLgSyo3AsM3eA9bPOt8bAEOV6NUWGRZ9FYvHSx6R0pfYgkMmk2DCH1+Z7KwB5gKazjLGgpLgUOAuRZWALnDSncxLAOYCmskbqjhe02h5d6y0sFKF5cXgI8LrLwB9PTeGew6POwNnptlpYOVLi4nFjjuWts957rnBk8tomoZ+bjhPcqOcCcnAG34EaTqOjxmsNKxzQnAkX5wronsOry6zIn66ThljLNcg+W1a2Gi55+MCg6XcKl3NuxrbxouS87TLAcY1V0QV5+8jLyuEekeeSGTS1gOcM/lZpOrlN/DsRzOyi8CY2fLuwUum/wR1BT+ZUzrDKUv9D4LB9rXZEjNTfRjZYFS5r86ebfA3W0bcmMKFh01/5fMoorm6rSjAA2SNc2F8dvmQVWCgdy8fxg8gcEN0pWez80QUyyQFAqn/N9mhmK5PAYN7adecCPnMsUCCZ7U8ari4IGb87wJeKFDA/MlmHXBDVkgTR1CV4/gaThKzBoeKYpuSzqSrqSzEiFuJDayWxqyQJp3RUhYSKfWUSEz5iDIrhrZl8I5b37JvrTBT3wdpd43cOqT/WiJhq6ikQpkW5a8BxuS/X219uXZHoPKmdMUGdEgpWzTll3Kr95Z8VJK7N3NL7b/qHY2rnmdjd6G7oF3q/b/3RoFaPDajwIcBWiQgMHioxZoEKChfqDBc2csnmxtM2ZglMDKArFvduhBbLDv9sOD8oymA0xBCHVtl6+c7ey6Ibdt+3ox7WOoxMCmD4i68PrZkBQaEDUe1tnVqSyyfl79+vr6evz1C2jKogkYWEEc0JnViiZRqKuoqJiZtEJcn0GIsykewzhW2jJVZjzBamxsfK79ase/5MoXL106TnEDwfq36qgIF6HGjKyqFsNkDGMwUNxEDEmIHQTxyNGjH1AchvumBcC4vAuXVpiA+TDYMFDXiiZFoN+SrmMI7tixo/v3337diNtQUzNpPq1RChIra5ccAFKDUEwYLra2fnXu3PmtA0gojqbaVUNl23ft+pPiPW73U7RGYdGH5QCQYCg93C73075S34I5c+ZQa0s/B1Njou51tVVVatJAXcrED3Q4EI5plgsHgAQiSiRCoRD9ECeam9fPo32UJzFQYwJLlix9mdZ9fb1naY2iyiQ2rVtyAEi199Pi5M8/tdB62vRpzceOH3+toaHBh61w2clTp96sqq5ehUnxw0eO7KA8KKpMYtO6JZcOKTUeNRhsp0+ffmtilYI1VLf4+Qvn1784d+5ezEfW144hMR05blglpDgHSbqxt6Wl5Y8ZM6afKq8oL7LZHd54PH7H7w+cOPj9dx8uXbLk+ICynbhm4cJDr7LVMKmhoP5dphaWoFGrHMTAQrgBJCjkFdQHpPntqCUmiWCge14PBsvdFnUYlP8AMAKfKIKmYukAAAAASUVORK5CYII=",menuIconURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAABGdBTUEAALGPC/xhBQAAA9dJREFUWAnNmE2IFEcUgF/9dE/v7LoaM9kkK4JBRA0EFBIPRm85hBAvEXHXwyo5eFE87GFcReMkObgJiQnkkJzEg9n8HIJixKNe1IMKihgiCbviwV11V3d0d3pmuqsqr5ppcEnb3TNVggVFVVe9eu+r97qqq4tASqp8/fsboQgmU0TMugi571K29bPy9ovPU8Sf16HbpQj3EkYFBcJcr5Am2nZfs94AIWVfqMQeHNwhICUBZ4ypUIA/X2sbIm2AW8AJK0lkEP6TJpfqwXgg4QxmF/fB7Gtvxk1G5ZKHU1CqTgPJoSUXYJYeohSUJu+qrqdVUGh2/pVX4VFffx77WaqBZkrkEFj271+qWH0sXcU3FBzyQe/Mg7B//LbKMTRTxNiDbsMHHjTJlyM7HEJIBHXs2KXFj+oTNSdoQOCYLS5jD9IwBMm5H8NplwwPb/QV4yEIcycaAza9IuA76B38fuz1OF5RXUkmHCdu6rg0BpSMgV/sAe7DdzGFrvvdi0D3mSZjQA0wt7REQsY+iWF0XbfFzyal8SLRxuteD+Du4h4Z/flbqaBHibAQtZmQtcZaAZSMwtTylaR/4vaw1ju5YhWG10pwwAqghmp2FeHO2+t11WqyM80W0m7vAOhsM1kD7CGz8L57Jsq6bitZC/GcWgLf1H6KuHT92cTDAFy/BgXMXm0OCpgV50Bo9kK3BqiBboabQMMU/WoL5im4jToeq/AIgXsiRx5KKCjcwPEsiAv/BQMu9EwyDHXd/3kqCOSzDk6t5/YglQKKeJwq+PNRmJI8kwSTaj1HZy5AhSHqnXkIvU9mMUwEw4Q5wTM57LUtkg8QPw/cdcBJ+PhvKJ0Gj80nGq6JXrg6/XFiX97GXIBpyqTieKpKViOl+WEhWXMaUavvvdIZ8Giy5+Lh3bwKm/t+Be3JazMfxc1tldY26rastiHcsQevTG9pw0znovkAcRWHzSDKnZtaOJLSfMFLB5RqtRBS4LbCurqLCy0YPkU3C0IIPEimMqR2ei7ZX2+KQdRi/WahNT/GmfOD4Vyzhx/66pcjp85dUvcmp6J8+txldXh07PPskdkS+V6EbD0vTOKlB0x9B/O6BS8ULly9PgE6x4kDPR/XX5pyYKj8xcCucsUmkNUQE0JvKKm2VioVK5HRE7UKOHbi6B94RzP+93jtpC0vWgXUF0hr3ipuw8uadwd3jXxoA9IK4Pah8t6BneV9GgjD28Svw1mlxFobgFbeFTz13cKbth93fDryp2CEq0a4hTA+aAPQ/ESJFDdvXLzzzrqNjlTqOP6uDeFf0uhvJ0ZP2QD8D6ZzU6u8YIbBAAAAAElFTkSuQmCC",showStatusButton:!0,blocks:[{opcode:"whenGesture",text:o({id:"gdxfor.whenGesture",default:"when [GESTURE]",description:"when the sensor detects a gesture"}),blockType:i.HAT,arguments:{GESTURE:{type:r.STRING,menu:"gestureOptions",defaultValue:A}}},{opcode:"whenForcePushedOrPulled",text:o({id:"gdxfor.whenForcePushedOrPulled",default:"when force sensor [PUSH_PULL]",description:"when the force sensor is pushed or pulled"}),blockType:i.HAT,arguments:{PUSH_PULL:{type:r.STRING,menu:"pushPullOptions",defaultValue:T}}},{opcode:"getForce",text:o({id:"gdxfor.getForce",default:"force",description:"gets force"}),blockType:i.REPORTER},"---",{opcode:"whenTilted",text:o({id:"gdxfor.whenTilted",default:"when tilted [TILT]",description:"when the sensor detects tilt"}),blockType:i.HAT,arguments:{TILT:{type:r.STRING,menu:"tiltAnyOptions",defaultValue:C}}},{opcode:"isTilted",text:o({id:"gdxfor.isTilted",default:"tilted [TILT]?",description:"is the device tilted?"}),blockType:i.BOOLEAN,arguments:{TILT:{type:r.STRING,menu:"tiltAnyOptions",defaultValue:C}}},{opcode:"getTilt",text:o({id:"gdxfor.getTilt",default:"tilt angle [TILT]",description:"gets tilt"}),blockType:i.REPORTER,arguments:{TILT:{type:r.STRING,menu:"tiltOptions",defaultValue:x}}},"---",{opcode:"isFreeFalling",text:o({id:"gdxfor.isFreeFalling",default:"falling?",description:"is the device in free fall?"}),blockType:i.BOOLEAN},{opcode:"getSpinSpeed",text:o({id:"gdxfor.getSpin",default:"spin speed [DIRECTION]",description:"gets spin speed"}),blockType:i.REPORTER,arguments:{DIRECTION:{type:r.STRING,menu:"axisOptions",defaultValue:P}}},{opcode:"getAcceleration",text:o({id:"gdxfor.getAcceleration",default:"acceleration [DIRECTION]",description:"gets acceleration"}),blockType:i.REPORTER,arguments:{DIRECTION:{type:r.STRING,menu:"axisOptions",defaultValue:R}}}],menus:{pushPullOptions:{acceptReporters:!0,items:this.PUSH_PULL_MENU},gestureOptions:{acceptReporters:!0,items:this.GESTURE_MENU},axisOptions:{acceptReporters:!0,items:this.AXIS_MENU},tiltOptions:{acceptReporters:!0,items:this.TILT_MENU},tiltAnyOptions:{acceptReporters:!0,items:this.TILT_MENU_ANY}}}}whenForcePushedOrPulled(t){switch(t.PUSH_PULL){case T:return this._peripheral.getForce()<-5;case E:return this._peripheral.getForce()>5;default:return s.warn("unknown push/pull value in whenForcePushedOrPulled: ".concat(t.PUSH_PULL)),!1}}getForce(){return Math.round(this._peripheral.getForce())}whenGesture(t){switch(t.GESTURE){case A:return this.gestureMagnitude()>30;case k:return this.isFreeFalling();case I:return this._isFacing(I);case S:return this._isFacing(S);default:return s.warn("unknown gesture value in whenGesture: ".concat(t.GESTURE)),!1}}_isFacing(t){void 0===this._facingUp&&(this._facingUp=!1),void 0===this._facingDown&&(this._facingDown=!1);let e=9;switch((this._facingUp||this._facingDown)&&(e-=5),this._facingUp=this._peripheral.getAccelerationZ()>e,this._facingDown=this._peripheral.getAccelerationZ()<-1*e,t){case I:return this._facingUp;case S:return this._facingDown;default:return!1}}whenTilted(t){return this._isTilted(t.TILT)}isTilted(t){return this._isTilted(t.TILT)}getTilt(t){return this._getTiltAngle(t.TILT)}_isTilted(t){return t===C?this._getTiltAngle(x)>15||this._getTiltAngle(O)>15||this._getTiltAngle(M)>15||this._getTiltAngle(N)>15:this._getTiltAngle(t)>15}_getTiltAngle(t){if(!this._peripheral.isConnected())return 0;switch(t){case x:return Math.round(this._peripheral.getTiltFrontBack(!0));case O:return Math.round(this._peripheral.getTiltFrontBack(!1));case M:return Math.round(this._peripheral.getTiltLeftRight(!0));case N:return Math.round(this._peripheral.getTiltLeftRight(!1));default:s.warn("Unknown direction in getTilt: ".concat(t))}}getSpinSpeed(t){switch(t.DIRECTION){case R:return Math.round(this._peripheral.getSpinSpeedX());case D:return Math.round(this._peripheral.getSpinSpeedY());case P:return Math.round(this._peripheral.getSpinSpeedZ());default:s.warn("Unknown direction in getSpinSpeed: ".concat(t.DIRECTION))}}getAcceleration(t){switch(t.DIRECTION){case R:return Math.round(this._peripheral.getAccelerationX());case D:return Math.round(this._peripheral.getAccelerationY());case P:return Math.round(this._peripheral.getAccelerationZ());default:s.warn("Unknown direction in getAcceleration: ".concat(t.DIRECTION))}}magnitude(t,e,n){return Math.sqrt(t*t+e*e+n*n)}accelMagnitude(){return this.magnitude(this._peripheral.getAccelerationX(),this._peripheral.getAccelerationY(),this._peripheral.getAccelerationZ())}gestureMagnitude(){return this.accelMagnitude()-9.8}spinMagnitude(){return this.magnitude(this._peripheral.getSpinSpeedX(),this._peripheral.getSpinSpeedY(),this._peripheral.getSpinSpeedZ())}isFreeFalling(){if(!this._peripheral.isConnected())return!1;return this.accelMagnitude()<.5+.3*this.spinMagnitude()}}t.exports=L},function(t,e,n){t.exports=function(){"use strict";function e(t,e,n,r,i,s,o){try{var a=t[s](o),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,i)}function r(t){return function(){var n=this,r=arguments;return new Promise((function(i,s){var o=t.apply(n,r);function a(t){e(o,i,s,a,c,"next",t)}function c(t){e(o,i,s,a,c,"throw",t)}a(void 0)}))}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function o(t,e,n){return e&&s(t.prototype,e),n&&s(t,n),t}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function l(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}!function(e){var n,r=Object.prototype,i=r.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag",u="object"==typeof t,l=e.regeneratorRuntime;if(l)u&&(t.exports=l);else{(l=e.regeneratorRuntime=u?t.exports:{}).wrap=w;var h="suspendedStart",d="suspendedYield",p="executing",f="completed",m={},g={};g[o]=function(){return this};var b=Object.getPrototypeOf,y=b&&b(b(C([])));y&&y!==r&&i.call(y,o)&&(g=y);var v=k.prototype=E.prototype=Object.create(g);A.prototype=v.constructor=k,k.constructor=A,k[c]=A.displayName="GeneratorFunction",l.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===A||"GeneratorFunction"===(e.displayName||e.name))},l.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,k):(t.__proto__=k,c in t||(t[c]="GeneratorFunction")),t.prototype=Object.create(v),t},l.awrap=function(t){return{__await:t}},I(S.prototype),S.prototype[a]=function(){return this},l.AsyncIterator=S,l.async=function(t,e,n,r){var i=new S(w(t,e,n,r));return l.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},I(v),v[c]="Generator",v[o]=function(){return this},v.toString=function(){return"[object Generator]"},l.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},l.values=C,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(M),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,i){return a.type="throw",a.arg=t,e.next=r,i&&(e.method="next",e.arg=n),!!i}for(var s=this.tryEntries.length-1;s>=0;--s){var o=this.tryEntries[s],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=i.call(o,"catchLoc"),u=i.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var s=r;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=t,o.arg=e,s?(this.method="next",this.next=s.finallyLoc,m):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),M(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;M(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:C(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),m}}}function w(t,e,n,r){var i=e&&e.prototype instanceof E?e:E,s=Object.create(i.prototype),o=new N(r||[]);return s._invoke=function(t,e,n){var r=h;return function(i,s){if(r===p)throw new Error("Generator is already running");if(r===f){if("throw"===i)throw s;return R()}for(n.method=i,n.arg=s;;){var o=n.delegate;if(o){var a=x(o,n);if(a){if(a===m)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===h)throw r=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=p;var c=T(t,e,n);if("normal"===c.type){if(r=n.done?f:d,c.arg===m)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=f,n.method="throw",n.arg=c.arg)}}}(t,n,o),s}function T(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function E(){}function A(){}function k(){}function I(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function S(t){var e;this._invoke=function(n,r){function s(){return new Promise((function(e,s){!function e(n,r,s,o){var a=T(t[n],t,r);if("throw"!==a.type){var c=a.arg,u=c.value;return u&&"object"==typeof u&&i.call(u,"__await")?Promise.resolve(u.__await).then((function(t){e("next",t,s,o)}),(function(t){e("throw",t,s,o)})):Promise.resolve(u).then((function(t){c.value=t,s(c)}),(function(t){return e("throw",t,s,o)}))}o(a.arg)}(n,r,e,s)}))}return e=e?e.then(s,s):s()}}function x(t,e){var r=t.iterator[e.method];if(r===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=n,x(t,e),"throw"===e.method))return m;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var i=T(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,m;var s=i.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,m):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,s=function e(){for(;++r<t.length;)if(i.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=n,e.done=!0,e};return s.next=s}}return{next:R}}function R(){return{value:n,done:!0}}}(function(){return this||"object"==typeof self&&self}()||Function("return this")());var h=new Uint8Array([88,0,0,0]),d=new Uint8Array([26,165,74,6,73,7,72,8,71,9,70,10,69,11,68,12,67,13,66,14,65]),p=new Uint8Array([24,255,1,0,0,0,0,0,0,0,0,0,0,0,0]),f=new Uint8Array([25,255,0,255,255,255,255]),m=new Uint8Array([27,255,0,0,0,0,0,0,0,0,0]),g={HEADER:h,INIT:d,DISCONNECT:new Uint8Array([84]),START_MEASUREMENTS:p,STOP_MEASUREMENTS:f,SET_MEASUREMENT_PERIOD:m,GET_INFO:new Uint8Array([85]),GET_STATUS:new Uint8Array([16]),GET_SENSOR_IDS:new Uint8Array([81]),GET_SENSOR_INFO:new Uint8Array([80,0]),GET_DEFAULT_SENSORS_MASK:new Uint8Array([86])},b=6,y=7,v=10,w=8,T=9,E=11,A=12,k=13,I=14,S=32,x=function(t){return 0!==t},O=function(){function t(){i(this,t),this._listenerMap=new Map}return o(t,[{key:"on",value:function(t,e){this._listenerMap.has(t)||this._listenerMap.set(t,[]),this._listenerMap.get(t).push(e)}},{key:"off",value:function(t,e){var n=this._listenerMap.get(t);if(n&&n.length){var r=n.reduce((function(t,n,r){return"function"==typeof n&&n===e?t=r:t}),-1);if(r>-1)return n.splice(r,1),this._listenerMap.set(t,n),!0}return!1}},{key:"unbind",value:function(){this._listenerMap.clear()}},{key:"emit",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];var i=this._listenerMap.get(t);return!(!i||!i.length||(i.forEach((function(t){t.apply(void 0,n)})),0))}}]),t}(),M=function(){},N=function(){};function C(t){return Array.from(new Uint8Array(t)).map((function(t){return t.toString(16).padStart(2,"0")})).join(" ")}var R,D=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,t),this.type=e.type,this.mode=e.mode,this.minValue=e.minValue,this.maxValue=e.maxValue,this.uncertainty=e.uncertainty,this.minPeriod=e.minPeriod,this.maxPeriod=e.maxPeriod,this.typicalPeriod=e.typicalPeriod,this.granularity=e.granularity},P=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,t),this.number=e.number,this.name=e.name,this.unit=e.unit,this.id=e.id,this.mutalExclusionMask=e.mutalExclusionMask,this.measurementInfo=e.measurementInfo},L=function(){function t(e){var n;return i(this,t),(n=l(this,c(t).call(this))).number=e.number,n.name=e.name,n.unit=e.unit,n.specs=e,n.enabled=!1,n.values=[],n.value=null,n}return a(t,O),o(t,[{key:"clear",value:function(){this.value=null,this.values=[]}},{key:"setValue",value:function(t,e){this.value=t,e&&this.values.push(this.value),this.emit("value-changed",this)}},{key:"setEnabled",value:function(t){this.enabled!==t&&(this.enabled=t,this.emit("state-changed",this))}}]),t}(),B=function(){function t(e){var r;if(i(this,t),r=l(this,c(t).call(this)),"undefined"==typeof TextDecoder){var s=n(18);R=s.TextDecoder}else R=TextDecoder;return r.device=e,r.sensors=[],r.opened=!1,r.rollingCounter=0,r.collecting=!1,r.measurementPeriod=10,r.response=null,r.remainingResponseLength=0,r.defaultSensorsMask=0,r.keepValues=!0,r.minMeasurementPeriod=10,r.serialNumber="",r.orderCode="",r.name="",r}return a(t,O),o(t,[{key:"getBatteryLevel",value:function(){var t=r(regeneratorRuntime.mark((function t(){var e;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getStatus();case 2:return e=t.sent,t.abrupt("return",e.battery);case 4:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"getChargingState",value:function(){var t=r(regeneratorRuntime.mark((function t(){var e;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getStatus();case 2:return e=t.sent,t.abrupt("return",e.chargingStatus);case 4:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"open",value:function(){var t=r(regeneratorRuntime.mark((function t(){var e,n=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=n.length>0&&void 0!==n[0]&&n[0],t.prev=1,t.next=4,this._connect();case 4:return t.next=6,this._init();case 6:return t.next=8,this._getStatus();case 8:return t.next=10,this._getDeviceInfo();case 10:return t.next=12,this._getDefaultSensorsMask();case 12:return t.next=14,this._getAvailableSensors();case 14:this._onOpened(),e&&this.start(),t.next=21;break;case 18:t.prev=18,t.t0=t.catch(1),console.error(t.t0);case 21:case"end":return t.stop()}}),t,this,[[1,18]])})));return function(){return t.apply(this,arguments)}}()},{key:"close",value:function(){var t=r(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._stopMeasurements();case 2:return t.next=4,this._sendCommand(g.DISCONNECT);case 4:return t.abrupt("return",this._disconnect());case 5:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"enableDefaultSensors",value:function(){for(var t=1,e=0;e<32;++e){if((this.defaultSensorsMask&t)===t){var n=this.getSensor(e);n&&n.setEnabled(!0)}t<<=1}}},{key:"start",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=this.sensors.filter((function(t){return t.enabled}));0===e.length&&(this.enableDefaultSensors(),e=this.sensors.filter((function(t){return t.enabled}))),e.forEach((function(t){return t.clear()})),t&&(this.measurementPeriod=t),this._startMeasurements()}},{key:"stop",value:function(){this._stopMeasurements()}},{key:"getSensor",value:function(t){return this.sensors.find((function(e){return e.number===t}))}},{key:"_connect",value:function(){var t=r(regeneratorRuntime.mark((function t(){var e=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.device.setup({onClosed:function(){return e._onClosed()},onResponse:function(t){return e._handleResponse(t)}}));case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"_disconnect",value:function(){var t=r(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.device.close());case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"_init",value:function(){return this.collecting=!1,this.rollingCounter=255,this.writeQueue=[],this._sendCommand(g.INIT)}},{key:"_handleResponse",value:function(t){if(M("command notified: ".concat(C(t.buffer))),this.remainingResponseLegnth>0){if(this.remainingResponseLegnth-=t.buffer.byteLength,this.response=new DataView((e=this.response.buffer,n=t.buffer.slice(0),(r=new Uint8Array(e.byteLength+n.byteLength)).set(new Uint8Array(e),0),r.set(new Uint8Array(n),e.byteLength),r.buffer)),this.remainingResponseLegnth>0)return}else this.response=t;var e,n,r,i=this.response.getUint8(1);if(i>this.response.buffer.byteLength)this.remainingResponseLegnth=i-this.response.buffer.byteLength;else if(M("handle command: ".concat(C(this.response.buffer))),this.response.getUint8(0)===S)this._processMeasurements(this.response);else{var s=this.response.getUint8(4),o=this.response.getUint8(5),a=new DataView(this.response.buffer,6);this._resolveWriteCommand(s,o,a),this.remainingResponseLegnth=0,this.response=null}}},{key:"_getSensorsWithMask",value:function(t){for(var e=[],n=1,r=0;r<32;++r){if((t&n)===n){var i=this.getSensor(r);i&&(e.push(i),M("available: [".concat(t,"] ").concat(e[e.length-1].number)))}n<<=1}return e}},{key:"_processMeasurements",value:function(t){var e=[],n=!0,r=0,i=0,s=t.getUint8(4);switch(s){case b:e=this._getSensorsWithMask(t.getUint16(5,!0)),r=t.getUint8(7,!0),i=9;break;case y:e=this._getSensorsWithMask(t.getUint32(5,!0)),r=t.getUint8(9,!0),i=11;break;case v:case w:e[0]=this.getSensor(t.getUint8(6)),r=t.getUint8(7,!0),i=8;break;case E:case T:e[0]=this.getSensor(t.getUint8(6)),r=t.getUint8(7,!0),i=8,n=!1;break;case A:case k:case I:M("Purposely Ignoring packet type: ".concat(s));break;default:M("Unknown packet type: ".concat(s))}for(var o=0;o<r;++o)for(var a=0;a<e.length;++a)n?e[a].setValue(t.getFloat32(i,!0),this.keepValues):e[a].setValue(t.getInt32(i,!0),this.keepValues),i+=4}},{key:"_resolveWriteCommand",value:function(t,e,n){var r=this.writeQueue.find((function(n){return n.command===t&&n.rollingCounter===e}));r&&(r.resolve(n),this.writeQueue=this.writeQueue.filter((function(t){return t!==r})))}},{key:"_onOpened",value:function(){M("opened"),this.opened=!0,this.emit("device-opened")}},{key:"_onClosed",value:function(){M("closed"),this.opened=!1,this.emit("device-closed")}},{key:"_decRollingCounter",value:function(){return this.rollingCounter-=1,this.rollingCounter}},{key:"_calculateChecksum",value:function(t){for(var e=t[1],n=-1*t[3],r=0;r<e;++r)n+=t[r],n&=255;return n<0||n>255?(M("Checksum failed!"),0):n}},{key:"_sendCommand",value:function(t){var e=new Uint8Array(g.HEADER.byteLength+t.byteLength);return e.set(new Uint8Array(g.HEADER),0),e.set(new Uint8Array(t),g.HEADER.byteLength),e[1]=e.length,e[2]=this._decRollingCounter(),e[3]=this._calculateChecksum(e),this._queueWriteCommand(e,0,e.length)}},{key:"_writeCommand",value:function(){var t=r(regeneratorRuntime.mark((function t(e,n,r){var i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(r>0)){t.next=12;break}return t.prev=1,r>20?(i=e.subarray(n,n+20),r-=20,n+=20):(i=e.subarray(n,n+r),r=0),t.next=5,this.device.writeCommand(i);case 5:t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),M("Write Failure: ".concat(t.t0));case 10:t.next=0;break;case 12:case"end":return t.stop()}}),t,this,[[1,7]])})));return function(e,n,r){return t.apply(this,arguments)}}()},{key:"_queueWriteCommand",value:function(t,e,n){var r=this;M("command queued: ".concat(C(t)));var i=new Promise((function(e,n){r.writeQueue.push({command:t[4],rollingCounter:t[2],resolve:e,reject:n}),setTimeout((function(){r.writeQueue=r.writeQueue.filter((function(e){return e.command===t[4]&&e.rollingCounter!==t[2]})),n(new Error("write command timed out after 5s. Command: ".concat(t[4].toString(16)," Rolling Counter: ").concat(t[2].toString(16))))}),1e4)}));return this._writeCommand(t,e,n),i}},{key:"_getStatus",value:function(){var t=r(regeneratorRuntime.mark((function t(){var e,n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._sendCommand(g.GET_STATUS);case 2:return e=t.sent,n={masterFirmwareVersion:"".concat(e.getUint8(2),".").concat(e.getUint8(3)),bleFirmwareVersion:"".concat(e.getUint8(6),".").concat(e.getUint8(9)),battery:e.getUint8(10),chargingStatus:"".concat(e.getUint8(11))},t.abrupt("return",n);case 5:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"_getAvailableSensors",value:function(){var t=r(regeneratorRuntime.mark((function t(){var e,n,r=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._sendCommand(g.GET_SENSOR_IDS).then((function(t){r.availableSensors=t.getUint32(0,!0),M("Get Available Sensors Returned ".concat(r.availableSensors))}));case 2:e=1,n=0;case 4:if(!(n<31)){t.next=12;break}if((this.availableSensors&e)!==e){t.next=8;break}return t.next=8,this._getSensorInfo(n);case 8:e<<=1;case 9:++n,t.next=4;break;case 12:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"_getDefaultSensorsMask",value:function(){var t=this;return this._sendCommand(g.GET_DEFAULT_SENSORS_MASK).then((function(e){t.defaultSensorsMask=e.getUint32(0,!0),M("Default Sensors:"),N(t)}))}},{key:"_getDeviceInfo",value:function(){var t=this;return this._sendCommand(g.GET_INFO).then((function(e){var n=new R("utf-8");t.orderCode=n.decode(new Uint8Array(e.buffer,6,16).filter(x)),t.serialNumber=n.decode(new Uint8Array(e.buffer,22,16).filter(x)),t.name=n.decode(new Uint8Array(e.buffer,38,32).filter(x)),M("Device Info:"),N(t)}))}},{key:"_getSensorInfo",value:function(){var t=r(regeneratorRuntime.mark((function t(e){var n,r=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(n=new Uint8Array(g.GET_SENSOR_INFO))[1]=e,t.abrupt("return",this._sendCommand(n).then((function(t){var e=t.getUint32(2,!0);if(e>0){var n=new R("utf-8"),i=new D({type:t.getUint8(6),mode:t.getUint8(7),minValue:t.getFloat64(108,!0),maxValue:t.getFloat64(116,!0),uncertainty:t.getFloat64(100,!0),minPeriod:t.getUint32(124,!0)/1e3,maxPeriod:((t.getUint32(132,!0)<<32)+t.getUint32(128,!0))/1e3,typicalPeriod:t.getUint32(136,!0)/1e3,granularity:t.getUint32(140,!0)/1e3}),s=new P({number:t.getUint8(0),name:n.decode(new Uint8Array(t.buffer,14,60).filter(x)),unit:n.decode(new Uint8Array(t.buffer,74,32).filter(x)),mutalExclusiveMask:t.getUint32(144,!0),measurementInfo:i,sensorId:e}),o=new L(s);M("Get Sensor Info Returned"),N(o),r.sensors.push(o),o.on("state-changed",(function(){M("Sensor Restart: ".concat(o.number)),o.enabled&&(r.measurementPeriod=o.specs.measurementInfo.typicalPeriod,r.sensors.forEach((function(t){if(o.number!==t.number&&t.enabled){var e=1<<t.number;(e&o.specs.mutalExclusiveMask)===e?t.enabled=!1:t.specs.measurementInfo.typicalPeriod>r.measurementPeriod&&(r.measurementPeriod=t.specs.measurementInfo.typicalPeriod)}}))),r._restartMeasurements()}))}})));case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"_restartMeasurements",value:function(){var t=r(regeneratorRuntime.mark((function t(){var e;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=this.collecting,!this.collecting){t.next=10;break}return t.prev=2,t.next=5,this._stopMeasurements();case 5:t.next=10;break;case 7:t.prev=7,t.t0=t.catch(2),console.error(t.t0);case 10:if(this.collecting||!e){t.next=19;break}return t.prev=11,t.next=14,this._startMeasurements();case 14:t.next=19;break;case 16:t.prev=16,t.t1=t.catch(11),console.error(t.t1);case 19:case"end":return t.stop()}}),t,this,[[2,7],[11,16]])})));return function(){return t.apply(this,arguments)}}()},{key:"_setMeasurementPeriod",value:function(t){var e=new Uint8Array(g.SET_MEASUREMENT_PERIOD),n=1e3*this.minMeasurementPeriod;return t<n&&(t=n),M("MeasurementPeriod: ".concat(t)),e[3]=255&t,e[4]=t>>8&255,e[5]=t>>16&255,e[6]=t>>24&255,this._sendCommand(e)}},{key:"_getEnabledChannelMask",value:function(){var t=0;return this.sensors.filter((function(t){return t.enabled})).forEach((function(e){t+=1<<e.number})),t}},{key:"_startMeasurements",value:function(){var t=this;return this._setMeasurementPeriod(1e3*this.measurementPeriod).then((function(){var e=t._getEnabledChannelMask();M("ChannelMask: ".concat(e));var n=new Uint8Array(g.START_MEASUREMENTS);return n[3]=255&e,n[4]=e>>8&255,n[5]=e>>16&255,n[6]=e>>24&255,t._sendCommand(n).then((function(e){0===e.getUint8(0)&&(t.collecting=!0,t.emit("measurements-started"))}))}))}},{key:"_stopMeasurements",value:function(){var t=this;return this._sendCommand(g.STOP_MEASUREMENTS).then((function(e){0===e.getUint8(0)&&(t.collecting=!1,t.emit("measurements-stopped"))}))}}]),t}(),U=function(){function t(e){i(this,t),this.webBluetoothNativeDevice=e,this.deviceCommand=null,this.deviceResponse=null}return o(t,[{key:"writeCommand",value:function(){var t=r(regeneratorRuntime.mark((function t(e){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.deviceCommand.writeValue(e));case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"setup",value:function(){var t=r(regeneratorRuntime.mark((function t(e){var n,r,i,s,o=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.onClosed,r=e.onResponse,this.webBluetoothNativeDevice.addEventListener("gattserverdisconnected",n),t.prev=2,t.next=5,this.webBluetoothNativeDevice.gatt.connect();case 5:return i=t.sent,t.next=8,i.getPrimaryService("d91714ef-28b9-4f91-ba16-f0d9a604f112");case 8:return s=t.sent,t.next=11,s.getCharacteristics();case 11:t.sent.forEach((function(t){switch(t.uuid){case"f4bf14a6-c7d5-4b6d-8aa8-df1a7c83adcb":o.deviceCommand=t;break;case"b41e6675-a329-40e0-aa01-44d2f444babe":o.deviceResponse=t,o.deviceResponse.addEventListener("characteristicvaluechanged",(function(t){var e=t.target.value;r(e)})),o.deviceResponse.startNotifications();break;default:M("No case found for ".concat(t.uuid))}})),t.next=18;break;case 15:t.prev=15,t.t0=t.catch(2),console.error(t.t0);case 18:if(this.deviceCommand&&this.deviceResponse){t.next=20;break}throw new Error("Expected command and response characteristics not found.");case 20:case"end":return t.stop()}}),t,this,[[2,15]])})));return function(e){return t.apply(this,arguments)}}()},{key:"close",value:function(){var t=r(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.webBluetoothNativeDevice.gatt.disconnect());case 1:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"godirectAdapter",get:function(){return!0}}]),t}(),j={createDevice:function(){var t=r(regeneratorRuntime.mark((function t(e){var n,r,i,s,o,a,c,u=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=u.length>1&&void 0!==u[1]?u[1]:{},r=n.open,i=void 0===r||r,s=n.startMeasurements,o=void 0===s||s,(a=e).godirectAdapter||(a=new U(e)),c=new B(a),!i){t.next=14;break}return t.prev=5,t.next=8,c.open(o);case 8:t.next=14;break;case 10:throw t.prev=10,t.t0=t.catch(5),console.error(t.t0),t.t0;case 14:return t.abrupt("return",c);case 15:case"end":return t.stop()}}),t,this,[[5,10]])})));return function(e){return t.apply(this,arguments)}}(),selectDevice:function(){var t=r(regeneratorRuntime.mark((function t(){var e;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(navigator.bluetooth){t.next=2;break}return t.abrupt("return",Promise.reject(new Error("No Web Bluetooth support.")));case 2:return t.next=4,navigator.bluetooth.requestDevice({filters:[{namePrefix:"GDX"}],optionalServices:["d91714ef-28b9-4f91-ba16-f0d9a604f112"]});case 4:return e=t.sent,t.abrupt("return",j.createDevice(e));case 6:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()};return j}()},function(t,e,n){const r=n(14);t.exports=class{constructor(t,e){let{service:n,commandChar:r,responseChar:i}=e;this.socket=t,this._service=n,this._commandChar=r,this._responseChar=i,this._onResponse=this._onResponse.bind(this),this._deviceOnResponse=null}get godirectAdapter(){return!0}writeCommand(t){const e=r.uint8ArrayToBase64(t);return this.socket.write(this._service,this._commandChar,e,"base64")}setup(t){let{onResponse:e}=t;return this._deviceOnResponse=e,this.socket.startNotifications(this._service,this._responseChar,this._onResponse)}_onResponse(t){const e=r.base64ToUint8Array(t),n=new DataView(e.buffer);return this._deviceOnResponse(n)}}},function(t,e,n){const r=n(5),i=n(2),s=n(3),o=n(1),a="data:image/svg+xml;base64,".concat(btoa('<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><path fill="none" stroke="#fff" stroke-width="11.51815371" d="M24.457 7.707a18.41 18.41 0 0 0-.365 2.31c-.02.224 0 .507.06.852.061.405.092.689.092.851 0 .527-.345.79-1.034.79-.446 0-.74-.131-.881-.395-.02-.446-.01-1.054.03-1.824.04-.912.061-1.52.061-1.824-.02 0-.05-.02-.091-.06a98.522 98.522 0 0 0-5.32.364c-.04.264-.04.588 0 .973l.122 1.094c-.081.629-.122 1.56-.122 2.797.061.527.091 2.786.091 6.779v2.219c0 .344.051.587.152.73h1.885c.77-.102 1.155.222 1.155.972 0 .446-.213.76-.638.942-.264.102-.73.122-1.399.061-.405-.04-.881-.05-1.428-.03-.75.101-1.662.182-2.736.243-1.094.06-1.763-.091-2.006-.456-.162-.243-.162-.496 0-.76.283-.446 1.023-.669 2.219-.669.628 0 .942-.172.942-.516 0-.183-.01-.355-.03-.517 0-.507.01-.953.03-1.338.06-1.094.06-2.634 0-4.62-.081-2.878-.05-5.462.091-7.752l-.09-.09c-.63.04-1.805.03-3.527-.031-.081 0-.7.04-1.854.121.283 1.946.446 3.334.486 4.165l-.06.82c-.021.305-.274.457-.76.457-.386 0-.71-.73-.973-2.19-.122-.87-.244-1.752-.365-2.644 0-.142-.071-.385-.213-.73-.122-.364-.39-.97-.39-1.152 0-.641.593-.489 1.363-.61.06 0 .162.01.304.03.142.02.243.03.304.03H17.1a57.098 57.098 0 0 0 5.411-.486c.122-.06.304-.121.547-.182.426-.04.79.06 1.095.304.304.223.405.547.304.972z"/><path fill="none" stroke="#ff4c4c" stroke-width="5.75909785" d="M24.333 7.71q-.244 1.065-.365 2.311-.03.335.06.851.092.608.092.851 0 .79-1.034.79-.669 0-.881-.394-.03-.67.03-1.824.06-1.368.06-1.824-.03 0-.09-.061-2.827.122-5.32.365-.06.395 0 .973l.122 1.094q-.122.942-.122 2.796.091.79.091 6.78v2.218q0 .517.152.73h1.885q1.155-.152 1.155.973 0 .668-.638.942-.396.152-1.399.06-.608-.06-1.428-.03-1.125.152-2.736.243-1.642.092-2.006-.456-.244-.364 0-.76.425-.668 2.219-.668.942 0 .942-.517 0-.274-.03-.517 0-.76.03-1.337.091-1.642 0-4.62-.122-4.317.091-7.752l-.091-.091q-.942.06-3.526-.03-.122 0-1.854.12.425 2.919.486 4.165l-.06.821q-.031.456-.76.456-.578 0-.974-2.189-.182-1.307-.364-2.644 0-.213-.213-.73-.182-.547-.182-.82 0-.76 1.155-.943.09 0 .304.03.212.03.304.03h7.538q2.797-.12 5.411-.485.182-.092.547-.183.639-.06 1.095.304.456.335.304.973z"/><path fill="#fff" d="M24.31 7.714q-.243 1.064-.365 2.31-.03.335.061.852.091.608.091.85 0 .791-1.033.791-.67 0-.882-.395-.03-.669.03-1.824.061-1.368.061-1.824-.03 0-.09-.06-2.828.121-5.32.364-.061.396 0 .973l.121 1.094q-.121.943-.121 2.797.09.79.09 6.779v2.219q0 .517.153.73h1.884q1.156-.153 1.156.972 0 .669-.639.942-.395.152-1.398.061-.608-.06-1.429-.03-1.125.152-2.736.243-1.641.091-2.006-.456-.243-.365 0-.76.426-.669 2.22-.669.941 0 .941-.516 0-.274-.03-.517 0-.76.03-1.338.092-1.641 0-4.62-.121-4.317.092-7.752l-.092-.09q-.942.06-3.526-.031-.121 0-1.854.121.426 2.919.486 4.165l-.06.82q-.03.457-.76.457-.578 0-.973-2.19-.182-1.306-.365-2.644 0-.212-.213-.73-.182-.546-.182-.82 0-.76 1.155-.942.091 0 .304.03t.304.03h7.539q2.796-.121 5.41-.486.183-.091.548-.182.638-.061 1.094.304.456.334.304.972z"/></svg>'));t.exports=class{constructor(t){this.runtime=t}getInfo(){return{id:"tw",name:"TurboWarp",color1:"#ff4c4c",color2:"#e64444",color3:"#c73a3a",docsURI:"https://docs.turbowarp.org/blocks",menuIconURI:a,blockIconURI:a,blocks:[{opcode:"getLastKeyPressed",text:r({id:"tw.blocks.lastKeyPressed",default:"last key pressed",description:"Block that returns the last key that was pressed"}),blockType:i.REPORTER},{opcode:"getButtonIsDown",text:r({id:"tw.blocks.buttonIsDown",default:"[MOUSE_BUTTON] mouse button down?",description:"Block that returns whether a specific mouse button is down"}),blockType:i.BOOLEAN,arguments:{MOUSE_BUTTON:{type:s.NUMBER,menu:"mouseButton",defaultValue:"0"}}}],menus:{mouseButton:{items:[{text:r({id:"tw.blocks.mouseButton.primary",default:"(0) primary",description:"Dropdown item to select primary (usually left) mouse button"}),value:"0"},{text:r({id:"tw.blocks.mouseButton.middle",default:"(1) middle",description:"Dropdown item to select middle mouse button"}),value:"1"},{text:r({id:"tw.blocks.mouseButton.secondary",default:"(2) secondary",description:"Dropdown item to select secondary (usually right) mouse button"}),value:"2"}],acceptReporters:!0}}}}getLastKeyPressed(t,e){return e.ioQuery("keyboard","getLastKeyPressed")}getButtonIsDown(t,e){const n=o.toNumber(t.MOUSE_BUTTON);return e.ioQuery("mouse","getButtonIsDown",[n])}}},function(t,e,n){(function(e){const r=n(223),i=n(225),s=n(71),o=n(226),a=n(227),c=t=>{try{return new URL(t,location.href)}catch(t){return null}},u=t=>new Promise((n=>{const s=[],u=Object.assign({},e.Scratch||{},r);u.extensions={unsandboxed:!0,register:t=>{s.push(t),n(s)}},u.vm=t,u.renderer=t.runtime.renderer,u.canFetch=async e=>{const n=c(e);return!!n&&("blob:"===n.protocol||"data:"===n.protocol||t.securityManager.canFetch(n.href))},u.canOpenWindow=async e=>{const n=c(e);return!!n&&("javascript:"!==n.protocol&&t.securityManager.canOpenWindow(n.href))},u.canRedirect=async e=>{const n=c(e);return!!n&&("javascript:"!==n.protocol&&t.securityManager.canRedirect(n.href))},u.canRecordAudio=async()=>t.securityManager.canRecordAudio(),u.canRecordVideo=async()=>t.securityManager.canRecordVideo(),u.canReadClipboard=async()=>t.securityManager.canReadClipboard(),u.canNotify=async()=>t.securityManager.canNotify(),u.canGeolocate=async()=>t.securityManager.canGeolocate(),u.canEmbed=async e=>{const n=c(e);return!!n&&t.securityManager.canEmbed(n.href)},u.canDownload=async(e,n)=>{const r=c(e);return!!r&&("javascript:"!==r.protocol&&t.securityManager.canDownload(e,n))},u.fetch=async(t,e)=>{const n=t instanceof Request?t.url:t,r=a(t);if(r)return r;if(!await u.canFetch(n))throw new Error("Permission to fetch ".concat(n," rejected."));return fetch(t,e)},u.openWindow=async(t,e)=>{if(!await u.canOpenWindow(t))throw new Error("Permission to open tab ".concat(t," rejected."));const n="noreferrer";return e=e?"".concat(n,",").concat(e):n,window.open(t,"_blank",e)},u.redirect=async t=>{if(!await u.canRedirect(t))throw new Error("Permission to redirect to ".concat(t," rejected."));location.href=t},u.download=async(t,e)=>{if(!await u.canDownload(t,e))throw new Error("Permission to download ".concat(e," rejected."));const n=document.createElement("a");n.href=t,n.download=e,document.body.appendChild(n),n.click(),n.remove()},u.translate=o(t),e.Scratch=u,e.ScratchExtensions=i(u),t.emit("CREATE_UNSANDBOXED_EXTENSION_API",u)})),l=new s(((t,n)=>new Promise(((e,r)=>{u(n).then(e);const i=document.createElement("script");i.onerror=()=>{r(new Error("Error in unsandboxed script ".concat(t,". Check the console for more information.")))},i.src=t,document.body.appendChild(i)})).then((t=>(e.Scratch.extensions.register=()=>{throw new Error("Too late to register new extensions.")},t)))),1);t.exports={setupUnsandboxedExtensionAPI:u,load:(t,e)=>l.do(t,e)}}).call(this,n(8))},function(t,e,n){const r={ArgumentType:n(3),BlockType:n(2),BlockShape:n(224),TargetType:n(36),Cast:n(1)};t.exports=r},function(t,e,n){const r=n(68),i={HEXAGONAL:r.OUTPUT_SHAPE_HEXAGONAL,ROUND:r.OUTPUT_SHAPE_ROUND,SQUARE:r.OUTPUT_SHAPE_SQUARE};t.exports=i},function(t,e,n){const r=n(3),i=n(2),{argumentIndexToId:s,generateExtensionId:o}=n(70),a=t=>{if(""===t||" "===t||"w"===t)return{type:i.COMMAND,async:"w"===t};if("r"===t||"R"===t)return{type:i.REPORTER,async:"R"===t};if("b"===t)return{type:i.BOOLEAN,async:!1};if("h"===t)return{type:i.HAT,async:!1};throw new Error("Unknown ScratchX block type: ".concat(t))},c=(t,e)=>{const n={},i="string"==typeof(s=e)||"number"==typeof s||"boolean"==typeof s;var s;if(i&&"b"!==t&&(n.defaultValue=e),"s"===t)n.type=r.STRING,i||(n.defaultValue="");else if("n"===t)n.type=r.NUMBER,i||(n.defaultValue=0);else if("m"===t[0]){n.type=r.STRING;const e=t.split(/\.|:/)[1];n.menu=e}else{if("b"!==t)throw new Error("Unknown ScratchX argument type: ".concat(t));n.type=r.BOOLEAN}return n},u=(t,e,n)=>r=>{const i=[];for(let t=0;t<e;t++)i.push(r[s(t)]);return n?new Promise((e=>{t(...i,e)})):t(...i)},l=new Map;t.exports=t=>({register:(e,n,r)=>{const i=((t,e,n)=>{const r={id:o(t),name:e.displayName||t,blocks:[],color1:"#4a4a5e",color2:"#31323f",color3:"#191a21"},i={getInfo:()=>r,_getStatus:n._getStatus};e.url&&(r.docsURI=e.url);for(const t of e.blocks){if(1===t.length){r.blocks.push("---");continue}const e=t[0],o=t[1],l=t[2],h=t.slice(3);let d="";const p=[],f=o.split(/%([\w.:]+)/g);for(let t=0;t<f.length;t++){const e=f[t];if(t%2==1){c(e);const n=Math.floor(t/2).toString(),r=h[n],i=s(n);p[i]=c(e,r),d+="[".concat(i,"]")}else d+=e}const m=a(e),g={opcode:l,blockType:m.type,text:d,arguments:p};r.blocks.push(g);const b=n[l],y=p.length;i[l]=u(b,y,m.async)}const l=e.menus;if(l){const t={};for(const e of Object.keys(l)||{}){const n={items:l[e]};t[e]=n}r.menus=t}return i})(e,n,r);l.set(e,i),t.extensions.register(i)},getStatus:t=>{const e=l.get(t);return e?e._getStatus():{status:0,msg:"does not exist"}}})},function(t,e,n){const r=n(5);t.exports=t=>{const e=r.namespace(),n=(t,n)=>{if(t&&"object"==typeof t);else{if("string"!=typeof t)throw new Error("unsupported data type in translate()");t={default:t}}return e(t,n)},i=t=>"_".concat(t),s=()=>t?t.getLocale():"undefined"!=typeof navigator?navigator.language:"en";let o={};return n.setup=t=>{t&&(o=t),e.setup({locale:s(),missingTranslation:"ignore",generateId:i,translations:o})},Object.defineProperty(n,"language",{configurable:!0,enumerable:!0,get:()=>s()}),n.setup({}),t&&t.on("LOCALE_CHANGED",(()=>{n.setup(null)})),n}},function(t,e,n){const r=n(14);t.exports=t=>{try{const e=t.match(/^data:([/-\w\d]*);base64,/i);if(e){const n=e[1].toLowerCase(),i=t.substring(e[0].length),s=r.base64ToUint8Array(i);return new Response(s,{headers:{"content-type":n,"content-length":s.byteLength}})}}catch(t){}return null}},function(t,e,n){t.exports=function(){return n(229)('!function(n){var e={};function t(r){if(e[r])return e[r].exports;var a=e[r]={i:r,l:!1,exports:{}};return n[r].call(a.exports,a,a.exports,t),a.l=!0,a.exports}t.m=n,t.c=e,t.d=function(n,e,r){t.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:r})},t.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},t.t=function(n,e){if(1&e&&(n=t(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var a in n)t.d(r,a,function(e){return n[e]}.bind(null,a));return r},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},t.p="",t(t.s=7)}([function(n,e,t){const r=t(19);r.enable(),n.exports=r("vm")},function(n,e){n.exports={ANGLE:"angle",BOOLEAN:"Boolean",COLOR:"color",NUMBER:"number",STRING:"string",MATRIX:"matrix",NOTE:"note",IMAGE:"image",COSTUME:"costume",SOUND:"sound"}},function(n,e){n.exports={BOOLEAN:"Boolean",BUTTON:"button",LABEL:"label",COMMAND:"command",CONDITIONAL:"conditional",EVENT:"event",HAT:"hat",LOOP:"loop",REPORTER:"reporter",XML:"xml"}},function(n,e){n.exports={isWorker:!0,centralDispatchService:self}},function(n,e){var t="long",r="short",a="narrow",i="numeric",o="2-digit";n.exports={number:{decimal:{style:"decimal"},integer:{style:"decimal",maximumFractionDigits:0},currency:{style:"currency",currency:"USD"},percent:{style:"percent"},default:{style:"decimal"}},date:{short:{month:i,day:i,year:o},medium:{month:r,day:i,year:i},long:{month:t,day:i,year:i},full:{month:t,day:i,year:i,weekday:t},default:{month:r,day:i,year:i}},time:{short:{hour:i,minute:i},medium:{hour:i,minute:i,second:i},long:{hour:i,minute:i,second:i,timeZoneName:r},full:{hour:i,minute:i,second:i,timeZoneName:r},default:{hour:i,minute:i,second:i}},duration:{default:{hours:{minimumIntegerDigits:1,maximumFractionDigits:0},minutes:{minimumIntegerDigits:2,maximumFractionDigits:0},seconds:{minimumIntegerDigits:2,maximumFractionDigits:3}}},parseNumberPattern:function(n){if(n){var e={},t=n.match(/\\b[A-Z]{3}\\b/i),r=n.replace(/[^¤]/g,"").length;if(!r&&t&&(r=1),r?(e.style="currency",e.currencyDisplay=1===r?"symbol":2===r?"code":"name",e.currency=t?t[0].toUpperCase():"USD"):n.indexOf("%")>=0&&(e.style="percent"),!/[@#0]/.test(n))return e.style?e:void 0;if(e.useGrouping=n.indexOf(",")>=0,/E\\+?[@#0]+/i.test(n)||n.indexOf("@")>=0){var a=n.replace(/E\\+?[@#0]+|[^@#0]/gi,"");e.minimumSignificantDigits=Math.min(Math.max(a.replace(/[^@0]/g,"").length,1),21),e.maximumSignificantDigits=Math.min(Math.max(a.length,1),21)}else{for(var i=n.replace(/[^#0.]/g,"").split("."),o=i[0],s=o.length-1;"0"===o[s];)--s;e.minimumIntegerDigits=Math.min(Math.max(o.length-1-s,1),21);var c=i[1]||"";for(s=0;"0"===c[s];)++s;for(e.minimumFractionDigits=Math.min(Math.max(s,0),20);"#"===c[s];)++s;e.maximumFractionDigits=Math.min(Math.max(s,0),20)}return e}},parseDatePattern:function(n){if(n){for(var e={},s=0;s<n.length;){for(var c=n[s],l=1;n[++s]===c;)++l;switch(c){case"G":e.era=5===l?a:4===l?t:r;break;case"y":case"Y":e.year=2===l?o:i;break;case"M":case"L":l=Math.min(Math.max(l-1,0),4),e.month=[i,o,r,t,a][l];break;case"E":case"e":case"c":e.weekday=5===l?a:4===l?t:r;break;case"d":case"D":e.day=2===l?o:i;break;case"h":case"K":e.hour12=!0,e.hour=2===l?o:i;break;case"H":case"k":e.hour12=!1,e.hour=2===l?o:i;break;case"m":e.minute=2===l?o:i;break;case"s":case"S":e.second=2===l?o:i;break;case"z":case"Z":case"v":case"V":e.timeZoneName=1===l?r:t}}return Object.keys(e).length?e:void 0}}}},function(n,e){n.exports=function(n,e){if("string"==typeof n&&e[n])return n;for(var t=[].concat(n||[]),r=0,a=t.length;r<a;++r)for(var i=t[r].split("-");i.length;){var o=i.join("-");if(e[o])return o;i.pop()}}},function(n,e,t){"use strict";var r="zero",a="one",i="two",o="few",s="many",c="other",l=[function(n){return 1===+n?a:c},function(n){var e=+n;return 0<=e&&e<=1?a:c},function(n){return 0===Math.floor(Math.abs(+n))||1===+n?a:c},function(n){var e=+n;return 0===e?r:1===e?a:2===e?i:3<=e%100&&e%100<=10?o:11<=e%100&&e%100<=99?s:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length;return 1===e&&0===t?a:c},function(n){var e=+n;return e%10==1&&e%100!=11?a:2<=e%10&&e%10<=4&&(e%100<12||14<e%100)?o:e%10==0||5<=e%10&&e%10<=9||11<=e%100&&e%100<=14?s:c},function(n){var e=+n;return e%10==1&&e%100!=11&&e%100!=71&&e%100!=91?a:e%10==2&&e%100!=12&&e%100!=72&&e%100!=92?i:(3<=e%10&&e%10<=4||e%10==9)&&(e%100<10||19<e%100)&&(e%100<70||79<e%100)&&(e%100<90||99<e%100)?o:0!==e&&e%1e6==0?s:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length,r=+(n+".").split(".")[1];return 0===t&&e%10==1&&e%100!=11||r%10==1&&r%100!=11?a:0===t&&2<=e%10&&e%10<=4&&(e%100<12||14<e%100)||2<=r%10&&r%10<=4&&(r%100<12||14<r%100)?o:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length;return 1===e&&0===t?a:2<=e&&e<=4&&0===t?o:0!==t?s:c},function(n){var e=+n;return 0===e?r:1===e?a:2===e?i:3===e?o:6===e?s:c},function(n){var e=Math.floor(Math.abs(+n)),t=+(""+n).replace(/^[^.]*.?|0+$/g,"");return 1===+n||0!==t&&(0===e||1===e)?a:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length,r=+(n+".").split(".")[1];return 0===t&&e%100==1||r%100==1?a:0===t&&e%100==2||r%100==2?i:0===t&&3<=e%100&&e%100<=4||3<=r%100&&r%100<=4?o:c},function(n){var e=Math.floor(Math.abs(+n));return 0===e||1===e?a:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length,r=+(n+".").split(".")[1];return 0===t&&(1===e||2===e||3===e)||0===t&&e%10!=4&&e%10!=6&&e%10!=9||0!==t&&r%10!=4&&r%10!=6&&r%10!=9?a:c},function(n){var e=+n;return 1===e?a:2===e?i:3<=e&&e<=6?o:7<=e&&e<=10?s:c},function(n){var e=+n;return 1===e||11===e?a:2===e||12===e?i:3<=e&&e<=10||13<=e&&e<=19?o:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length;return 0===t&&e%10==1?a:0===t&&e%10==2?i:0!==t||e%100!=0&&e%100!=20&&e%100!=40&&e%100!=60&&e%100!=80?0!==t?s:c:o},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length,r=+n;return 1===e&&0===t?a:2===e&&0===t?i:0===t&&(r<0||10<r)&&r%10==0?s:c},function(n){var e=Math.floor(Math.abs(+n)),t=+(""+n).replace(/^[^.]*.?|0+$/g,"");return 0===t&&e%10==1&&e%100!=11||0!==t?a:c},function(n){var e=+n;return 1===e?a:2===e?i:c},function(n){var e=+n;return 0===e?r:1===e?a:c},function(n){var e=Math.floor(Math.abs(+n)),t=+n;return 0===t?r:0!==e&&1!==e||0===t?c:a},function(n){var e=+(n+".").split(".")[1],t=+n;return t%10==1&&(t%100<11||19<t%100)?a:2<=t%10&&t%10<=9&&(t%100<11||19<t%100)?o:0!==e?s:c},function(n){var e=(n+".").split(".")[1].length,t=+(n+".").split(".")[1],i=+n;return i%10==0||11<=i%100&&i%100<=19||2===e&&11<=t%100&&t%100<=19?r:i%10==1&&i%100!=11||2===e&&t%10==1&&t%100!=11||2!==e&&t%10==1?a:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length,r=+(n+".").split(".")[1];return 0===t&&e%10==1&&e%100!=11||r%10==1&&r%100!=11?a:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length,r=+n;return 1===e&&0===t?a:0!==t||0===r||1!==r&&1<=r%100&&r%100<=19?o:c},function(n){var e=+n;return 1===e?a:0===e||2<=e%100&&e%100<=10?o:11<=e%100&&e%100<=19?s:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length;return 1===e&&0===t?a:0===t&&2<=e%10&&e%10<=4&&(e%100<12||14<e%100)?o:0===t&&1!==e&&0<=e%10&&e%10<=1||0===t&&5<=e%10&&e%10<=9||0===t&&12<=e%100&&e%100<=14?s:c},function(n){var e=Math.floor(Math.abs(+n));return 0<=e&&e<=1?a:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length;return 0===t&&e%10==1&&e%100!=11?a:0===t&&2<=e%10&&e%10<=4&&(e%100<12||14<e%100)?o:0===t&&e%10==0||0===t&&5<=e%10&&e%10<=9||0===t&&11<=e%100&&e%100<=14?s:c},function(n){var e=+n;return 0===Math.floor(Math.abs(+n))||1===e?a:2<=e&&e<=10?o:c},function(n){var e=Math.floor(Math.abs(+n)),t=+(n+".").split(".")[1],r=+n;return 0===r||1===r||0===e&&1===t?a:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length;return 0===t&&e%100==1?a:0===t&&e%100==2?i:0===t&&3<=e%100&&e%100<=4||0!==t?o:c},function(n){var e=+n;return 0<=e&&e<=1||11<=e&&e<=99?a:c},function(n){var e=+n;return 1===e||5===e||7===e||8===e||9===e||10===e?a:2===e||3===e?i:4===e?o:6===e?s:c},function(n){var e=Math.floor(Math.abs(+n));return e%10==1||e%10==2||e%10==5||e%10==7||e%10==8||e%100==20||e%100==50||e%100==70||e%100==80?a:e%10==3||e%10==4||e%1e3==100||e%1e3==200||e%1e3==300||e%1e3==400||e%1e3==500||e%1e3==600||e%1e3==700||e%1e3==800||e%1e3==900?o:0===e||e%10==6||e%100==40||e%100==60||e%100==90?s:c},function(n){var e=+n;return e%10!=2&&e%10!=3||e%100==12||e%100==13?c:o},function(n){var e=+n;return 1===e||3===e?a:2===e?i:4===e?o:c},function(n){var e=+n;return 0===e||7===e||8===e||9===e?r:1===e?a:2===e?i:3===e||4===e?o:5===e||6===e?s:c},function(n){var e=+n;return e%10==1&&e%100!=11?a:e%10==2&&e%100!=12?i:e%10==3&&e%100!=13?o:c},function(n){var e=+n;return 1===e||11===e?a:2===e||12===e?i:3===e||13===e?o:c},function(n){var e=+n;return 1===e?a:2===e||3===e?i:4===e?o:6===e?s:c},function(n){var e=+n;return 1===e||5===e?a:c},function(n){var e=+n;return 11===e||8===e||80===e||800===e?s:c},function(n){var e=Math.floor(Math.abs(+n));return 1===e?a:0===e||2<=e%100&&e%100<=20||e%100==40||e%100==60||e%100==80?s:c},function(n){var e=+n;return e%10==6||e%10==9||e%10==0&&0!==e?s:c},function(n){var e=Math.floor(Math.abs(+n));return e%10==1&&e%100!=11?a:e%10==2&&e%100!=12?i:e%10!=7&&e%10!=8||e%100==17||e%100==18?c:s},function(n){var e=+n;return 1===e?a:2===e||3===e?i:4===e?o:c},function(n){var e=+n;return 1<=e&&e<=4?a:c},function(n){var e=+n;return 1===e||5===e||7<=e&&e<=9?a:2===e||3===e?i:4===e?o:6===e?s:c},function(n){var e=+n;return 1===e?a:e%10==4&&e%100!=14?s:c},function(n){var e=+n;return e%10!=1&&e%10!=2||e%100==11||e%100==12?c:a},function(n){var e=+n;return e%10==6||e%10==9||10===e?o:c},function(n){var e=+n;return e%10==3&&e%100!=13?o:c}];n.exports={af:{cardinal:l[0]},ak:{cardinal:l[1]},am:{cardinal:l[2]},ar:{cardinal:l[3]},ars:{cardinal:l[3]},as:{cardinal:l[2],ordinal:l[34]},asa:{cardinal:l[0]},ast:{cardinal:l[4]},az:{cardinal:l[0],ordinal:l[35]},be:{cardinal:l[5],ordinal:l[36]},bem:{cardinal:l[0]},bez:{cardinal:l[0]},bg:{cardinal:l[0]},bh:{cardinal:l[1]},bn:{cardinal:l[2],ordinal:l[34]},br:{cardinal:l[6]},brx:{cardinal:l[0]},bs:{cardinal:l[7]},ca:{cardinal:l[4],ordinal:l[37]},ce:{cardinal:l[0]},cgg:{cardinal:l[0]},chr:{cardinal:l[0]},ckb:{cardinal:l[0]},cs:{cardinal:l[8]},cy:{cardinal:l[9],ordinal:l[38]},da:{cardinal:l[10]},de:{cardinal:l[4]},dsb:{cardinal:l[11]},dv:{cardinal:l[0]},ee:{cardinal:l[0]},el:{cardinal:l[0]},en:{cardinal:l[4],ordinal:l[39]},eo:{cardinal:l[0]},es:{cardinal:l[0]},et:{cardinal:l[4]},eu:{cardinal:l[0]},fa:{cardinal:l[2]},ff:{cardinal:l[12]},fi:{cardinal:l[4]},fil:{cardinal:l[13],ordinal:l[0]},fo:{cardinal:l[0]},fr:{cardinal:l[12],ordinal:l[0]},fur:{cardinal:l[0]},fy:{cardinal:l[4]},ga:{cardinal:l[14],ordinal:l[0]},gd:{cardinal:l[15],ordinal:l[40]},gl:{cardinal:l[4]},gsw:{cardinal:l[0]},gu:{cardinal:l[2],ordinal:l[41]},guw:{cardinal:l[1]},gv:{cardinal:l[16]},ha:{cardinal:l[0]},haw:{cardinal:l[0]},he:{cardinal:l[17]},hi:{cardinal:l[2],ordinal:l[41]},hr:{cardinal:l[7]},hsb:{cardinal:l[11]},hu:{cardinal:l[0],ordinal:l[42]},hy:{cardinal:l[12],ordinal:l[0]},ia:{cardinal:l[4]},io:{cardinal:l[4]},is:{cardinal:l[18]},it:{cardinal:l[4],ordinal:l[43]},iu:{cardinal:l[19]},iw:{cardinal:l[17]},jgo:{cardinal:l[0]},ji:{cardinal:l[4]},jmc:{cardinal:l[0]},ka:{cardinal:l[0],ordinal:l[44]},kab:{cardinal:l[12]},kaj:{cardinal:l[0]},kcg:{cardinal:l[0]},kk:{cardinal:l[0],ordinal:l[45]},kkj:{cardinal:l[0]},kl:{cardinal:l[0]},kn:{cardinal:l[2]},ks:{cardinal:l[0]},ksb:{cardinal:l[0]},ksh:{cardinal:l[20]},ku:{cardinal:l[0]},kw:{cardinal:l[19]},ky:{cardinal:l[0]},lag:{cardinal:l[21]},lb:{cardinal:l[0]},lg:{cardinal:l[0]},ln:{cardinal:l[1]},lt:{cardinal:l[22]},lv:{cardinal:l[23]},mas:{cardinal:l[0]},mg:{cardinal:l[1]},mgo:{cardinal:l[0]},mk:{cardinal:l[24],ordinal:l[46]},ml:{cardinal:l[0]},mn:{cardinal:l[0]},mo:{cardinal:l[25],ordinal:l[0]},mr:{cardinal:l[2],ordinal:l[47]},mt:{cardinal:l[26]},nah:{cardinal:l[0]},naq:{cardinal:l[19]},nb:{cardinal:l[0]},nd:{cardinal:l[0]},ne:{cardinal:l[0],ordinal:l[48]},nl:{cardinal:l[4]},nn:{cardinal:l[0]},nnh:{cardinal:l[0]},no:{cardinal:l[0]},nr:{cardinal:l[0]},nso:{cardinal:l[1]},ny:{cardinal:l[0]},nyn:{cardinal:l[0]},om:{cardinal:l[0]},or:{cardinal:l[0],ordinal:l[49]},os:{cardinal:l[0]},pa:{cardinal:l[1]},pap:{cardinal:l[0]},pl:{cardinal:l[27]},prg:{cardinal:l[23]},ps:{cardinal:l[0]},pt:{cardinal:l[28]},"pt-PT":{cardinal:l[4]},rm:{cardinal:l[0]},ro:{cardinal:l[25],ordinal:l[0]},rof:{cardinal:l[0]},ru:{cardinal:l[29]},rwk:{cardinal:l[0]},saq:{cardinal:l[0]},sc:{cardinal:l[4],ordinal:l[43]},scn:{cardinal:l[4],ordinal:l[43]},sd:{cardinal:l[0]},sdh:{cardinal:l[0]},se:{cardinal:l[19]},seh:{cardinal:l[0]},sh:{cardinal:l[7]},shi:{cardinal:l[30]},si:{cardinal:l[31]},sk:{cardinal:l[8]},sl:{cardinal:l[32]},sma:{cardinal:l[19]},smi:{cardinal:l[19]},smj:{cardinal:l[19]},smn:{cardinal:l[19]},sms:{cardinal:l[19]},sn:{cardinal:l[0]},so:{cardinal:l[0]},sq:{cardinal:l[0],ordinal:l[50]},sr:{cardinal:l[7]},ss:{cardinal:l[0]},ssy:{cardinal:l[0]},st:{cardinal:l[0]},sv:{cardinal:l[4],ordinal:l[51]},sw:{cardinal:l[4]},syr:{cardinal:l[0]},ta:{cardinal:l[0]},te:{cardinal:l[0]},teo:{cardinal:l[0]},ti:{cardinal:l[1]},tig:{cardinal:l[0]},tk:{cardinal:l[0],ordinal:l[52]},tl:{cardinal:l[13],ordinal:l[0]},tn:{cardinal:l[0]},tr:{cardinal:l[0]},ts:{cardinal:l[0]},tzm:{cardinal:l[33]},ug:{cardinal:l[0]},uk:{cardinal:l[29],ordinal:l[53]},ur:{cardinal:l[4]},uz:{cardinal:l[0]},ve:{cardinal:l[0]},vo:{cardinal:l[0]},vun:{cardinal:l[0]},wa:{cardinal:l[1]},wae:{cardinal:l[0]},xh:{cardinal:l[0]},xog:{cardinal:l[0]},yi:{cardinal:l[4]},zu:{cardinal:l[2]},lo:{ordinal:l[0]},ms:{ordinal:l[0]},vi:{ordinal:l[0]}}},function(n,e,t){(function(n){const e=t(9),r=t(15),a=t(17),i=t(0),{isWorker:o}=t(3),s=t(20)(null);n.Scratch=n.Scratch||{},Object.assign(n.Scratch,e,{canFetch:()=>Promise.resolve(!0),fetch:function(n){function e(e,t){return n.apply(this,arguments)}return e.toString=function(){return n.toString()},e}(((n,e)=>fetch(n,e))),canOpenWindow:()=>Promise.resolve(!1),openWindow:()=>Promise.reject(new Error("Scratch.openWindow not supported in sandboxed extensions")),canRedirect:()=>Promise.resolve(!1),redirect:()=>Promise.reject(new Error("Scratch.redirect not supported in sandboxed extensions")),canRecordAudio:()=>Promise.resolve(!1),canRecordVideo:()=>Promise.resolve(!1),canReadClipboard:()=>Promise.resolve(!1),canNotify:()=>Promise.resolve(!1),canGeolocate:()=>Promise.resolve(!1),canEmbed:()=>Promise.resolve(!1),canDownload:()=>Promise.resolve(!1),download:()=>Promise.reject(new Error("Scratch.download not supported in sandboxed extensions")),translate:s});const c=new class{constructor(){this.nextExtensionId=0,this.initialRegistrations=[],this.firstRegistrationPromise=new Promise((n=>{this.firstRegistrationCallback=n})),a.waitForConnection.then((()=>{a.call("extensions","allocateWorker").then((async n=>{const[e,t]=n;this.workerId=e;try{await(n=>{if(!o)return new Promise(((e,t)=>{const r=document.createElement("script");r.onload=()=>e(),r.onerror=()=>{t(new Error("Error in sandboxed script: ".concat(n,". Check the console for more information.")))},r.src=n,document.body.appendChild(r)}));importScripts(n)})(t),await this.firstRegistrationPromise;const n=this.initialRegistrations;this.initialRegistrations=null,Promise.all(n).then((()=>a.call("extensions","onWorkerInit",e)))}catch(n){i.error(n),a.call("extensions","onWorkerInit",e,"".concat(n))}}))})),this.extensions=[]}register(n){const e=this.nextExtensionId++;this.extensions.push(n);const t="extension.".concat(this.workerId,".").concat(e),r=a.setService(t,n).then((()=>a.call("extensions","registerExtensionService",t)));return this.initialRegistrations&&(this.firstRegistrationCallback(),this.initialRegistrations.push(r)),r}};n.Scratch.extensions={register:c.register.bind(c)},n.ScratchExtensions=r(n.Scratch)}).call(this,t(8))},function(n,e){var t;t=function(){return this}();try{t=t||new Function("return this")()}catch(n){"object"==typeof window&&(t=window)}n.exports=t},function(n,e,t){const r={ArgumentType:t(1),BlockType:t(2),BlockShape:t(10),TargetType:t(12),Cast:t(13)};n.exports=r},function(n,e,t){const r=t(11),a={HEXAGONAL:r.OUTPUT_SHAPE_HEXAGONAL,ROUND:r.OUTPUT_SHAPE_ROUND,SQUARE:r.OUTPUT_SHAPE_SQUARE};n.exports=a},function(n,e){n.exports={OUTPUT_SHAPE_HEXAGONAL:1,OUTPUT_SHAPE_ROUND:2,OUTPUT_SHAPE_SQUARE:3}},function(n,e){n.exports={SPRITE:"sprite",STAGE:"stage"}},function(n,e,t){const r=t(14),a=n=>{if("string"!=typeof n)return!1;for(let e=0;e<n.length;e++){const t=n.charCodeAt(e);if(48===t||9===t)return!1}return!0};class i{static toNumber(n){if("number"==typeof n)return Number.isNaN(n)?0:n;const e=Number(n);return Number.isNaN(e)?0:e}static toBoolean(n){return"boolean"==typeof n?n:"string"==typeof n?""!==n&&"0"!==n&&"false"!==n.toLowerCase():Boolean(n)}static toString(n){return String(n)}static toRgbColorList(n){const e=i.toRgbColorObject(n);return[e.r,e.g,e.b]}static toRgbColorObject(n){let e;return"string"==typeof n&&"#"===n.substring(0,1)?(e=r.hexToRgb(n),e||(e={r:0,g:0,b:0,a:255})):e=r.decimalToRgb(i.toNumber(n)),e}static isWhiteSpace(n){return null===n||"string"==typeof n&&0===n.trim().length}static compare(n,e){let t=Number(n),r=Number(e);if(0===t&&a(n)?t=NaN:0===r&&a(e)&&(r=NaN),isNaN(t)||isNaN(r)){const t=String(n).toLowerCase(),r=String(e).toLowerCase();return t<r?-1:t>r?1:0}return t===1/0&&r===1/0||t===-1/0&&r===-1/0?0:t-r}static isInt(n){return"number"==typeof n?!!isNaN(n)||n===Math.floor(n):"boolean"==typeof n||"string"==typeof n&&n.indexOf(".")<0}static get LIST_INVALID(){return"INVALID"}static get LIST_ALL(){return"ALL"}static toListIndex(n,e,t){if("number"!=typeof n){if("all"===n)return t?i.LIST_ALL:i.LIST_INVALID;if("last"===n)return e>0?e:i.LIST_INVALID;if("random"===n||"any"===n)return e>0?1+Math.floor(Math.random()*e):i.LIST_INVALID}return(n=Math.floor(i.toNumber(n)))<1||n>e?i.LIST_INVALID:n}}n.exports=i},function(n,e){class t{static get RGB_BLACK(){return{r:0,g:0,b:0}}static get RGB_WHITE(){return{r:255,g:255,b:255}}static decimalToHex(n){n<0&&(n+=16777216);let e=Number(n).toString(16);return e="#".concat("000000".substr(0,6-e.length)).concat(e),e}static decimalToRgb(n){const e=n>>24&255;return{r:n>>16&255,g:n>>8&255,b:255&n,a:e>0?e:255}}static hexToRgb(n){n.startsWith("#")&&(n=n.substring(1));const e=parseInt(n,16);if(isNaN(e))return null;if(6===n.length)return{r:e>>16&255,g:e>>8&255,b:255&e};if(3===n.length){const n=e>>8&15,t=e>>4&15,r=15&e;return{r:n<<4|n,g:t<<4|t,b:r<<4|r}}return null}static rgbToHex(n){return t.decimalToHex(t.rgbToDecimal(n))}static rgbToDecimal(n){return(n.r<<16)+(n.g<<8)+n.b}static hexToDecimal(n){return t.rgbToDecimal(t.hexToRgb(n))}static hsvToRgb(n){let e=n.h%360;e<0&&(e+=360);const t=Math.max(0,Math.min(n.s,1)),r=Math.max(0,Math.min(n.v,1)),a=Math.floor(e/60),i=e/60-a,o=r*(1-t),s=r*(1-t*i),c=r*(1-t*(1-i));let l,u,d;switch(a){default:case 0:l=r,u=c,d=o;break;case 1:l=s,u=r,d=o;break;case 2:l=o,u=r,d=c;break;case 3:l=o,u=s,d=r;break;case 4:l=c,u=o,d=r;break;case 5:l=r,u=o,d=s}return{r:Math.floor(255*l),g:Math.floor(255*u),b:Math.floor(255*d)}}static rgbToHsv(n){const e=n.r/255,t=n.g/255,r=n.b/255,a=Math.min(Math.min(e,t),r),i=Math.max(Math.max(e,t),r);let o=0,s=0;if(a!==i){o=60*((e===a?3:t===a?5:1)-(e===a?t-r:t===a?r-e:e-t)/(i-a))%360,s=(i-a)/i}return{h:o,s:s,v:i}}static mixRgb(n,e,t){if(t<=0)return n;if(t>=1)return e;const r=1-t;return{r:r*n.r+t*e.r,g:r*n.g+t*e.g,b:r*n.b+t*e.b}}}n.exports=t},function(n,e,t){const r=t(1),a=t(2),{argumentIndexToId:i,generateExtensionId:o}=t(16),s=n=>{if(""===n||" "===n||"w"===n)return{type:a.COMMAND,async:"w"===n};if("r"===n||"R"===n)return{type:a.REPORTER,async:"R"===n};if("b"===n)return{type:a.BOOLEAN,async:!1};if("h"===n)return{type:a.HAT,async:!1};throw new Error("Unknown ScratchX block type: ".concat(n))},c=(n,e)=>{const t={},a="string"==typeof(i=e)||"number"==typeof i||"boolean"==typeof i;var i;if(a&&"b"!==n&&(t.defaultValue=e),"s"===n)t.type=r.STRING,a||(t.defaultValue="");else if("n"===n)t.type=r.NUMBER,a||(t.defaultValue=0);else if("m"===n[0]){t.type=r.STRING;const e=n.split(/\\.|:/)[1];t.menu=e}else{if("b"!==n)throw new Error("Unknown ScratchX argument type: ".concat(n));t.type=r.BOOLEAN}return t},l=(n,e,t)=>r=>{const a=[];for(let n=0;n<e;n++)a.push(r[i(n)]);return t?new Promise((e=>{n(...a,e)})):n(...a)},u=new Map;n.exports=n=>({register:(e,t,r)=>{const a=((n,e,t)=>{const r={id:o(n),name:e.displayName||n,blocks:[],color1:"#4a4a5e",color2:"#31323f",color3:"#191a21"},a={getInfo:()=>r,_getStatus:t._getStatus};e.url&&(r.docsURI=e.url);for(const n of e.blocks){if(1===n.length){r.blocks.push("---");continue}const e=n[0],o=n[1],u=n[2],d=n.slice(3);let f="";const h=[],m=o.split(/%([\\w.:]+)/g);for(let n=0;n<m.length;n++){const e=m[n];if(n%2==1){c(e);const t=Math.floor(n/2).toString(),r=d[t],a=i(t);h[a]=c(e,r),f+="[".concat(a,"]")}else f+=e}const p=s(e),g={opcode:u,blockType:p.type,text:f,arguments:h};r.blocks.push(g);const b=t[u],v=h.length;a[u]=l(b,v,p.async)}const u=e.menus;if(u){const n={};for(const e of Object.keys(u)||{}){const t={items:u[e]};n[e]=t}r.menus=n}return a})(e,t,r);u.set(e,a),n.extensions.register(a)},getStatus:n=>{const e=u.get(n);return e?e._getStatus():{status:0,msg:"does not exist"}}})},function(n,e){n.exports={generateExtensionId:n=>{const e=n.replace(/[^a-z0-9]/gi,"").toLowerCase();return"sbx".concat(e)},argumentIndexToId:n=>n.toString()}},function(n,e,t){const r=t(18),a=t(0),{centralDispatchService:i}=t(3);n.exports=new class extends r{constructor(){super(),this._connectionPromise=new Promise((n=>{this._onConnect=n})),this.services={},this._onMessage=this._onMessage.bind(this,i),"undefined"!=typeof self&&(self.onmessage=this._onMessage)}get waitForConnection(){return this._connectionPromise}setService(n,e){return Object.prototype.hasOwnProperty.call(this.services,n)&&a.warn("Worker dispatch replacing existing service provider for ".concat(n)),this.services[n]=e,this.waitForConnection.then((()=>this._remoteCall(i,"dispatch","setService",n)))}_getServiceProvider(n){const e=this.services[n];return{provider:e||i,isRemote:!e}}_onDispatchMessage(n,e){let t;switch(e.method){case"handshake":t=this._onConnect();break;case"terminate":setTimeout((()=>self.close()),0),t=Promise.resolve();break;default:a.error("Worker dispatch received message for unknown method: ".concat(e.method))}return t}}},function(n,e,t){const r=t(0);n.exports=class{constructor(){this.callbacks=[],this.nextResponseId=0}call(n,e){for(var t=arguments.length,r=new Array(t>2?t-2:0),a=2;a<t;a++)r[a-2]=arguments[a];return this.transferCall(n,e,null,...r)}transferCall(n,e,t){try{const{provider:o,isRemote:s}=this._getServiceProvider(n);if(o){for(var r=arguments.length,a=new Array(r>3?r-3:0),i=3;i<r;i++)a[i-3]=arguments[i];if(s)return this._remoteTransferCall(o,n,e,t,...a);const c=o[e].apply(o,a);return Promise.resolve(c)}return Promise.reject(new Error("Service not found: ".concat(n)))}catch(n){return Promise.reject(n)}}_isRemoteService(n){return this._getServiceProvider(n).isRemote}_remoteCall(n,e,t){for(var r=arguments.length,a=new Array(r>3?r-3:0),i=3;i<r;i++)a[i-3]=arguments[i];return this._remoteTransferCall(n,e,t,null,...a)}_remoteTransferCall(n,e,t,r){for(var a=arguments.length,i=new Array(a>4?a-4:0),o=4;o<a;o++)i[o-4]=arguments[o];return new Promise(((a,o)=>{const s=this._storeCallbacks(a,o);i.length>0&&"function"==typeof i[i.length-1].func&&(i.pop(),i.pop()),r?n.postMessage({service:e,method:t,responseId:s,args:i},r):n.postMessage({service:e,method:t,responseId:s,args:i})}))}_storeCallbacks(n,e){const t=this.nextResponseId++;return this.callbacks[t]=[n,e],t}_deliverResponse(n,e){try{const[t,r]=this.callbacks[n];delete this.callbacks[n],e.error?r(e.error):t(e.result)}catch(n){r.error("Dispatch callback failed: ".concat(n))}}_onMessage(n,e){const t=e.data;let a;t.args=t.args||[],t.service?a="dispatch"===t.service?this._onDispatchMessage(n,t):this.call(t.service,t.method,...t.args):void 0===t.responseId?r.error("Dispatch caught malformed message from a worker: ".concat(JSON.stringify(e))):this._deliverResponse(t.responseId,t),a&&(void 0===t.responseId?r.error("Dispatch message missing required response ID: ".concat(JSON.stringify(e))):a.then((e=>n.postMessage({responseId:t.responseId,result:e})),(e=>n.postMessage({responseId:t.responseId,error:"".concat(e)}))))}_getServiceProvider(n){throw new Error("Could not get provider for ".concat(n,": _getServiceProvider not implemented"))}_onDispatchMessage(n,e){throw new Error("Unimplemented dispatch message handler cannot handle ".concat(e.method," method"))}}},function(n,e){const t="undefined"==typeof document,r=t?"[0m":"",a=t?"[90m":"",i=`${t?"[34m":""}debug${r}`,o=`${t?"[36m":""}info${r}`,s=`${t?"[33m":""}warn${r}`,c=`${t?"[31m":""}error${r}`,l=(n="")=>{const e=e=>l(n?`${n} ${e}`:e),t=n?[`${a}${n}${r}`]:[];return e.debug=e.log=console.debug.bind(console,...t,i),e.info=console.log.bind(console,...t,o),e.warn=e.warning=console.warn.bind(console,...t,s),e.error=console.error.bind(console,...t,c),e};l.enable=l.disable=()=>{},n.exports=l},function(n,e,t){const r=t(21);n.exports=n=>{const e=r.namespace(),t=(n,t)=>{if(n&&"object"==typeof n);else{if("string"!=typeof n)throw new Error("unsupported data type in translate()");n={default:n}}return e(n,t)},a=n=>"_".concat(n),i=()=>n?n.getLocale():"undefined"!=typeof navigator?navigator.language:"en";let o={};return t.setup=n=>{n&&(o=n),e.setup({locale:i(),missingTranslation:"ignore",generateId:a,translations:o})},Object.defineProperty(t,"language",{configurable:!0,enumerable:!0,get:()=>i()}),t.setup({}),n&&n.on("LOCALE_CHANGED",(()=>{t.setup(null)})),t}},function(n,e,t){"use strict";var r=t(22),a=t(23),i=t(6),o=t(5),s=t(4);function c(n,e){return Object.keys(e).forEach((function(t){n[t]=e[t]})),n}n.exports=function n(){var e=c({},s),t="en",l={},u=function(n){return n},d=null,f="warning",h={};function m(n,e,i){var o="string"==typeof n?n:n.default,s=b(o,"object"==typeof n&&n.id||u(o),i||t);return(s.format||(s.format=a(r(s.message),i||t,h)))(e)}m.rich=function(n,e,i){var o="string"==typeof n?n:n.default,s=b(o,"object"==typeof n&&n.id||u(o),i||t);return(s.toParts||(s.toParts=a.toParts(r(s.message,{tagsType:p}),i||t,h)))(e)};var p="<>";function g(n,e){var t=n[2];return function(n,e){var r="object"==typeof t?function(n,e){return Object.keys(n).reduce((function(t,r){return t[r]=n[r](e),t}),{})}(t,e):t;return"function"==typeof n?n(r):n}}function b(n,e,t){var r=o(t,l)||"en",a=l[r]||(l[r]={}),i=a[e];if("string"==typeof i&&(i=a[e]={message:i}),!i){var s=\'Translation for "\'+e+\'" in "\'+r+\'" is missing\';if("warning"===f)"undefined"!=typeof console&&console.warn(s);else if("ignore"!==f)throw new Error(s);var c="function"==typeof d?d(n,e,r)||n:d||n;i=a[e]={message:c}}return i}function v(n,e,r,a,s){"object"==typeof r&&"object"!=typeof a&&(s=a,a=r,r=0);var c=o(s||t,i),l=c&&i[c][n]||x;return a["="+ +e]||a[l(e-r)]||a.other}function x(){return"other"}return h[p]=g,m.setup=function(n){return(n=n||{}).locale&&(t=n.locale),"translations"in n&&(l=n.translations||{}),n.generateId&&(u=n.generateId),"missingReplacement"in n&&(d=n.missingReplacement),n.missingTranslation&&(f=n.missingTranslation),n.formats&&(n.formats.number&&c(e.number,n.formats.number),n.formats.date&&c(e.date,n.formats.date),n.formats.time&&c(e.time,n.formats.time)),n.types&&((h=n.types)[p]=g),{locale:t,translations:l,generateId:u,missingReplacement:d,missingTranslation:f,formats:e,types:h}},m.number=function(n,r,a){var i=r&&e.number[r]||e.parseNumberPattern(r)||e.number.default;return new Intl.NumberFormat(a||t,i).format(n)},m.date=function(n,r,a){var i=r&&e.date[r]||e.parseDatePattern(r)||e.date.default;return new Intl.DateTimeFormat(a||t,i).format(n)},m.time=function(n,r,a){var i=r&&e.time[r]||e.parseDatePattern(r)||e.time.default;return new Intl.DateTimeFormat(a||t,i).format(n)},m.select=function(n,e){return e[n]||e.other},m.custom=function(n,e,t,r){return n[1]in h?h[n[1]](n,e)(t,r):t},m.plural=v.bind(null,"cardinal"),m.selectordinal=v.bind(null,"ordinal"),m.namespace=n,m}()},function(n,e,t){"use strict";var r="{",a="}",i=",",o="#",s="<",c=">",l="</",u="/>",d="\'",f="offset:",h=["number","date","time","ordinal","duration","spellout"],m=["plural","select","selectordinal"];function p(n,e){var t=n.pattern,r=t.length,i=[],o=n.index,s=g(n,e);for(s&&i.push(s),s&&n.tokens&&n.tokens.push(["text",t.slice(o,n.index)]);n.index<r;){if(t[n.index]===a){if(!e)throw T(n);break}if(e&&n.tagsType&&t.slice(n.index,n.index+2)===l)break;i.push(x(n)),o=n.index,(s=g(n,e))&&i.push(s),s&&n.tokens&&n.tokens.push(["text",t.slice(o,n.index)])}return i}function g(n,e){for(var t=n.pattern,i=t.length,c="plural"===e||"selectordinal"===e,l=!!n.tagsType,u="{style}"===e,f="";n.index<i;){var h=t[n.index];if(h===r||h===a||c&&h===o||l&&h===s||u&&b(h.charCodeAt(0)))break;if(h===d)if((h=t[++n.index])===d)f+=h,++n.index;else if(h===r||h===a||c&&h===o||l&&h===s||u)for(f+=h;++n.index<i;)if((h=t[n.index])===d&&t[n.index+1]===d)f+=d,++n.index;else{if(h===d){++n.index;break}f+=h}else f+=d;else f+=h,++n.index}return f}function b(n){return n>=9&&n<=13||32===n||133===n||160===n||6158===n||n>=8192&&n<=8205||8232===n||8233===n||8239===n||8287===n||8288===n||12288===n||65279===n}function v(n){for(var e=n.pattern,t=e.length,r=n.index;n.index<t&&b(e.charCodeAt(n.index));)++n.index;r<n.index&&n.tokens&&n.tokens.push(["space",n.pattern.slice(r,n.index)])}function x(n){var e=n.pattern;if(e[n.index]===o)return n.tokens&&n.tokens.push(["syntax",o]),++n.index,[o];var t=function(n){var e=n.tagsType;if(!e||n.pattern[n.index]!==s)return;if(n.pattern.slice(n.index,n.index+2)===l)throw T(n,null,"closing tag without matching opening tag");n.tokens&&n.tokens.push(["syntax",s]);++n.index;var t=y(n,!0);if(!t)throw T(n,"placeholder id");n.tokens&&n.tokens.push(["id",t]);if(v(n),n.pattern.slice(n.index,n.index+2)===u)return n.tokens&&n.tokens.push(["syntax",u]),n.index+=2,[t,e];if(n.pattern[n.index]!==c)throw T(n,c);n.tokens&&n.tokens.push(["syntax",c]);++n.index;var r=p(n,e),a=n.index;if(n.pattern.slice(n.index,n.index+2)!==l)throw T(n,l+t+c);n.tokens&&n.tokens.push(["syntax",l]);n.index+=2;var i=y(n,!0);i&&n.tokens&&n.tokens.push(["id",i]);if(t!==i)throw n.index=a,T(n,l+t+c,l+i+c);if(v(n),n.pattern[n.index]!==c)throw T(n,c);n.tokens&&n.tokens.push(["syntax",c]);return++n.index,[t,e,{children:r}]}(n);if(t)return t;if(e[n.index]!==r)throw T(n,r);n.tokens&&n.tokens.push(["syntax",r]),++n.index,v(n);var d=y(n);if(!d)throw T(n,"placeholder id");n.tokens&&n.tokens.push(["id",d]),v(n);var m=e[n.index];if(m===a)return n.tokens&&n.tokens.push(["syntax",a]),++n.index,[d];if(m!==i)throw T(n,", or }");n.tokens&&n.tokens.push(["syntax",i]),++n.index,v(n);var g,b=y(n);if(!b)throw T(n,"placeholder type");if(n.tokens&&n.tokens.push(["type",b]),v(n),(m=e[n.index])===a){if(n.tokens&&n.tokens.push(["syntax",a]),"plural"===b||"selectordinal"===b||"select"===b)throw T(n,b+" sub-messages");return++n.index,[d,b]}if(m!==i)throw T(n,", or }");if(n.tokens&&n.tokens.push(["syntax",i]),++n.index,v(n),"plural"===b||"selectordinal"===b){var x=function(n){var e=n.pattern,t=e.length,r=0;if(e.slice(n.index,n.index+7)===f){n.tokens&&n.tokens.push(["offset","offset"],["syntax",":"]),n.index+=7,v(n);for(var a=n.index;n.index<t&&w(e.charCodeAt(n.index));)++n.index;if(a===n.index)throw T(n,"offset number");n.tokens&&n.tokens.push(["number",e.slice(a,n.index)]),r=+e.slice(a,n.index)}return r}(n);v(n),g=[d,b,x,M(n,b)]}else if("select"===b)g=[d,b,M(n,b)];else if(h.indexOf(b)>=0)g=[d,b,k(n)];else{var S=n.index,I=k(n);v(n),e[n.index]===r&&(n.index=S,I=M(n,b)),g=[d,b,I]}if(v(n),e[n.index]!==a)throw T(n,a);return n.tokens&&n.tokens.push(["syntax",a]),++n.index,g}function y(n,e){for(var t=n.pattern,l=t.length,u="";n.index<l;){var f=t[n.index];if(f===r||f===a||f===i||f===o||f===d||b(f.charCodeAt(0))||e&&(f===s||f===c||"/"===f))break;u+=f,++n.index}return u}function k(n){var e=n.index,t=g(n,"{style}");if(!t)throw T(n,"placeholder style name");return n.tokens&&n.tokens.push(["style",n.pattern.slice(e,n.index)]),t}function w(n){return n>=48&&n<=57}function M(n,e){for(var t=n.pattern,r=t.length,i={};n.index<r&&t[n.index]!==a;){var o=y(n);if(!o)throw T(n,"sub-message selector");n.tokens&&n.tokens.push(["selector",o]),v(n),i[o]=S(n,e),v(n)}if(!i.other&&m.indexOf(e)>=0)throw T(n,null,null,\'"other" sub-message must be specified in \'+e);return i}function S(n,e){if(n.pattern[n.index]!==r)throw T(n,"{ to start sub-message");n.tokens&&n.tokens.push(["syntax",r]),++n.index;var t=p(n,e);if(n.pattern[n.index]!==a)throw T(n,"} to end sub-message");return n.tokens&&n.tokens.push(["syntax",a]),++n.index,t}function T(n,e,t,r){var a=n.pattern,i=a.slice(0,n.index).split(/\\r?\\n/),o=n.index,s=i.length,c=i.slice(-1)[0].length;return t=t||(n.index>=a.length?"end of message pattern":y(n)||a[n.index]),r||(r=function(n,e){return n?"Expected "+n+" but found "+e:"Unexpected "+e+" found"}(e,t)),new I(r+=" in "+a.replace(/\\r?\\n/g,"\\n"),e,t,o,s,c)}function I(n,e,t,r,a,i){Error.call(this,n),this.name="SyntaxError",this.message=n,this.expected=e,this.found=t,this.offset=r,this.line=a,this.column=i}e=n.exports=function(n,e){return p({pattern:String(n),index:0,tagsType:e&&e.tagsType||null,tokens:e&&e.tokens||null},"")},I.prototype=Object.create(Error.prototype),e.SyntaxError=I},function(n,e,t){"use strict";var r=t(4),a=t(5),i=t(6);function o(n,e,t,r,a){var i=n.map((function(n){return function(n,e,t,r,a){if("string"==typeof n){var i=n;return function(){return i}}var c,l=n[0],u=n[1];if(e&&"#"===n[0]){l=e[0];var d=e[2],h=(r.number||f.number)([l,"number"],t);return function(n){return h(s(l,n)-d,n)}}"plural"===u||"selectordinal"===u?(c={},Object.keys(n[3]).forEach((function(e){c[e]=o(n[3][e],n,t,r,a)})),n=[n[0],n[1],n[2],c]):n[2]&&"object"==typeof n[2]&&(c={},Object.keys(n[2]).forEach((function(e){c[e]=o(n[2][e],n,t,r,a)})),n=[n[0],n[1],c]);var m=u&&(r[u]||f[u]);if(m){var p=m(n,t);return function(n){return p(s(l,n),n)}}return a?function(n){return String(s(l,n))}:function(n){return s(l,n)}}(n,e,t,r,a)}));return a?1===i.length?i[0]:function(n){for(var e="",t=0;t<i.length;++t)e+=i[t](n);return e}:function(n){return i.reduce((function(e,t){return e.concat(t(n))}),[])}}function s(n,e){if(e&&n in e)return e[n];for(var t=n.split("."),r=e,a=0,i=t.length;r&&a<i;++a)r=r[t[a]];return r}function c(n,e){var t=n[2],a=r.number[t]||r.parseNumberPattern(t)||r.number.default;return new Intl.NumberFormat(e,a).format}function l(n,e){var t=n[1],a=n[2],i=r[t][a]||r.parseDatePattern(a)||r[t].default;return new Intl.DateTimeFormat(e,i).format}function u(n,e){var t,r="selectordinal"===n[1]?"ordinal":"cardinal",o=n[2],s=n[3];if(Intl.PluralRules&&Intl.PluralRules.supportedLocalesOf(e).length>0)t=new Intl.PluralRules(e,{type:r});else{var c=a(e,i),l=c&&i[c][r]||d;t={select:l}}return function(n,e){return(s["="+ +n]||s[t.select(n-o)]||s.other)(e)}}function d(){return"other"}(e=n.exports=function(n,e,t){return o(n,null,e||"en",t||{},!0)}).toParts=function(n,e,t){return o(n,null,e||"en",t||{},!1)};var f={number:c,ordinal:c,spellout:c,duration:function(n,e){var t=n[2],a=r.duration[t]||r.duration.default,i=new Intl.NumberFormat(e,a.seconds).format,o=new Intl.NumberFormat(e,a.minutes).format,s=new Intl.NumberFormat(e,a.hours).format,c=/^fi$|^fi-|^da/.test(String(e))?".":":";return function(n,e){if(n=+n,!isFinite(n))return i(n);var t=~~(n/60/60),r=~~(n/60%60),a=(t?s(Math.abs(t))+c:"")+o(Math.abs(r))+c+i(Math.abs(n%60));return n<0?s(-1).replace(s(1),a):a}},date:l,time:l,plural:u,selectordinal:u,select:function(n,e){var t=n[2];return function(n,e){return(t[n]||t.other)(e)}}};e.types=f}]);',null)}},function(t,e,n){"use strict";var r=window.URL||window.webkitURL;t.exports=function(t,e){try{try{var n;try{(n=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)).append(t),n=n.getBlob()}catch(e){n=new Blob([t])}return new Worker(r.createObjectURL(n))}catch(e){return new Worker("data:application/javascript,"+encodeURIComponent(t))}}catch(t){if(!e)throw Error("Inline worker is not supported");return new Worker(e)}}},function(t,e,n){const r=n(17),i=n(15),s=n(9),o=n(46),a=n(7),{Map:c}=n(21),u=n(0),l=n(6),h=n(72);t.exports=class extends r{constructor(t,e){super(),e||(e=new i(t)),this.runtime=t,this.id=a(),this.blocks=e,this.variables={},this.comments={},this._customState={},this._edgeActivatedHatValues={},this.extensionStorage={}}onGreenFlag(){}getName(){return this.id}updateEdgeActivatedValue(t,e){const n=this._edgeActivatedHatValues[t];return this._edgeActivatedHatValues[t]=e,n}hasEdgeActivatedValue(t){return Object.prototype.hasOwnProperty.call(this._edgeActivatedHatValues,t)}clearEdgeActivatedValues(){this._edgeActivatedHatValues={}}lookupOrCreateVariable(t,e){let n=this.lookupVariableById(t);if(n)return n;if(n=this.lookupVariableByNameAndType(e,s.SCALAR_TYPE),n)return n;const r=new s(t,e,s.SCALAR_TYPE,!1);return this.variables[t]=r,r}lookupBroadcastMsg(t,e){let n;if(t?n=this.lookupVariableById(t):e?n=this.lookupBroadcastByInputValue(e):u.error("Cannot find broadcast message if neither id nor name are provided."),n)return e&&n.name.toLowerCase()!==e.toLowerCase()&&u.error("Found broadcast message with id: ".concat(t,", but")+"its name, ".concat(n.name," did not match expected name ").concat(e,".")),n.type!==s.BROADCAST_MESSAGE_TYPE&&u.error("Found variable with id: ".concat(t,", but its type ").concat(n.type)+"did not match expected type ".concat(s.BROADCAST_MESSAGE_TYPE)),n}lookupBroadcastByInputValue(t){const e=this.variables;for(const n in e)if(e[n].type===s.BROADCAST_MESSAGE_TYPE&&e[n].name.toLowerCase()===t.toLowerCase())return e[n]}lookupVariableById(t){if(Object.prototype.hasOwnProperty.call(this.variables,t))return this.variables[t];if(this.runtime&&!this.isStage){const e=this.runtime.getTargetForStage();if(e&&Object.prototype.hasOwnProperty.call(e.variables,t))return e.variables[t]}}lookupVariableByNameAndType(t,e,n){if("string"==typeof t){"string"!=typeof e&&(e=s.SCALAR_TYPE),n=n||!1;for(const n in this.variables){const r=this.variables[n];if(r.name===t&&r.type===e)return r}if(!n&&this.runtime&&!this.isStage){const n=this.runtime.getTargetForStage();if(n)for(const r in n.variables){const i=n.variables[r];if(i.name===t&&i.type===e)return i}}return null}}lookupOrCreateList(t,e){let n=this.lookupVariableById(t);if(n)return n;if(n=this.lookupVariableByNameAndType(e,s.LIST_TYPE),n)return n;const r=new s(t,e,s.LIST_TYPE,!1);return this.variables[t]=r,r}createVariable(t,e,n,r){if(!Object.prototype.hasOwnProperty.call(this.variables,t)){const i=new s(t,e,n,!1);r&&this.isStage&&this.runtime.canAddCloudVariable()&&(i.isCloud=!0,this.runtime.addCloudVariable(),this.runtime.ioDevices.cloud.requestCreateVariable(i)),this.variables[t]=i}}createComment(t,e,n,r,i,s,a,c){if(!Object.prototype.hasOwnProperty.call(this.comments,t)){const l=new o(t,n,r,i,s,a,c);if(e){l.blockId=e;const n=this.blocks.getBlock(e);n?n.comment=t:u.warn("Could not find block with id ".concat(e," associated with commentId: ").concat(t))}this.comments[t]=l}}renameVariable(t,e){if(Object.prototype.hasOwnProperty.call(this.variables,t)){const n=this.variables[t];if(n.id===t){const r=n.name;if(n.name=e,this.runtime){if(n.isCloud&&this.isStage&&this.runtime.ioDevices.cloud.requestRenameVariable(r,e),n.type===s.SCALAR_TYPE){let t=!1;this.runtime.targets.forEach((n=>{t=n.blocks.updateSensingOfReference(r,e,this.isStage?"_stage_":this.getName())||t})),t&&this.runtime.requestBlocksUpdate()}const i=this.runtime.monitorBlocks;i.changeBlock({id:t,element:"field",name:n.type===s.LIST_TYPE?"LIST":"VARIABLE",value:t},this.runtime);const o=i.getBlock(n.id);o&&this.runtime.requestUpdateMonitor(c({id:t,params:i._getBlockParams(o)}))}}}}deleteVariable(t){if(Object.prototype.hasOwnProperty.call(this.variables,t)){const e=this.variables[t].name,n=this.variables[t].isCloud;delete this.variables[t],this.runtime&&(n&&this.isStage&&(this.runtime.ioDevices.cloud.requestDeleteVariable(e),this.runtime.removeCloudVariable()),this.runtime.monitorBlocks.deleteBlock(t),this.runtime.requestRemoveMonitor(t))}}deleteMonitors(){let t;this.runtime.requestRemoveMonitorByTargetId(this.id),t=this.isStage?Object.keys(this.variables):Object.keys(this.runtime.monitorBlocks._blocks).filter((t=>this.runtime.monitorBlocks._blocks[t].targetId===this.id));for(const e of t)this.runtime.monitorBlocks.deleteBlock(e)}duplicateVariable(t,e){if(Object.prototype.hasOwnProperty.call(this.variables,t)){const n=this.variables[t],r=new s(e?t:null,n.name,n.type,n.isCloud);return r.type===s.LIST_TYPE?r.value=n.value.slice(0):r.value=n.value,r}return null}duplicateVariables(t){let e;return t&&(e=t.getAllVariableAndListReferences()),Object.keys(this.variables).reduce(((n,r)=>{const i=this.duplicateVariable(r,!t);if(n[i.id]=i,t&&e){const t=e[r];t&&this.mergeVariables(r,i.id,t)}return n}),{})}postSpriteInfo(){}getCustomState(t){return this._customState[t]}setCustomState(t,e){this._customState[t]=e}dispose(){this._customState={},this.runtime&&this.runtime.removeExecutable(this)}getAllVariableNamesInScopeByType(t,e){"string"!=typeof t&&(t=s.SCALAR_TYPE),e=e||!1;const n=Object.values(this.variables).filter((e=>e.type===t)).map((t=>t.name));if(e||this.isStage||!this.runtime)return n;const r=this.runtime.getTargetForStage().getAllVariableNamesInScopeByType(t);return n.concat(r)}mergeVariables(t,e,n,r){const i=n||this.blocks.getAllVariableAndListReferences()[t];h.updateVariableIdentifiers(i,e,r)}shareLocalVariableToStage(t,e){if(!this.runtime)return;const n=this.variables[t];if(!n)return void u.warn("Cannot share a local variable to the stage if it's not local.");const r=this.runtime.getTargetForStage(),i="StageVarFromLocal_".concat(t);let s=r.lookupVariableById(i);if(!s){const t=n.name,e=n.type,r="Stage: ".concat(t);s=this.runtime.createNewGlobalVariable(r,i,e)}this.mergeVariables(t,s.id,e,s.name)}shareLocalVariableToSprite(t,e,n){if(!this.runtime)return;if(this.isStage)return;const r=this.variables[t];if(!r)return void u.warn("Tried to call 'shareLocalVariableToSprite' with a non-local variable.");const i=r.name,o=r.type,a=e.lookupVariableByNameAndType(i,o);let c;if(a)c=a.id;else{const t=new s(null,i,o);c=t.id,e.variables[c]=t}this.mergeVariables(t,c,n)}resolveVariableSharingConflictsWithTarget(t,e){if(this.isStage)return;const n=this.blocks.getAllVariableAndListReferences(t);for(const t in n){if(!this.variables[t])continue;const r=n[t];e.isStage?this.shareLocalVariableToStage(t,r):this.shareLocalVariableToSprite(t,e,r)}}fixUpVariableReferences(){if(!this.runtime)return;if(this.isStage)return;const t=this.runtime.getTargetForStage();if(!t||!t.variables)return;const e=(e,n,r)=>{if(t.lookupVariableByNameAndType(n,r)){const t=l.unusedName("".concat(this.getName(),": ").concat(n),this.getAllVariableNamesInScopeByType(r));return this.renameVariable(e,t),t}return null},n=this.blocks.getAllVariableAndListReferences(),r=[];if(Object.keys(this.variables).length>0)for(const t in this.variables)Object.prototype.hasOwnProperty.call(this.variables,t)&&(n[t]||r.push(t));const i=Object.create(null),s=Object.create(null),o={},a=t=>{const e=o[t];return e||(o[t]=this.runtime.getAllVarNamesOfType(t),o[t])};for(const r in n){const o=n[r][0],c=o.referencingField.value,u=o.type;if(this.lookupVariableById(r)){if(Object.prototype.hasOwnProperty.call(this.variables,r)){const t=e(r,c,u);t&&n[r].map((e=>(e.referencingField.value=t,e)))}}else{const e=t.lookupVariableByNameAndType(c,u);if(e)i[r]||(i[r]=e.id);else{const e=a(u),n=l.unusedName(c,e);t.createVariable(r,n,u),s[r]||(s[r]=n)}}}for(const t in r){const n=r[t];e(n,this.variables[n].name,this.variables[n].type)}for(const t in i){const e=i[t],r=n[t];this.mergeVariables(t,e,r)}for(const t in s){const e=s[t];n[t].map((t=>(t.referencingField.value=e,t)))}}}},function(t,e,n){const r=n(73),i=n(76);t.exports=class{constructor(t){this._canvas=t||document.createElement("canvas"),this._context=this._canvas.getContext("2d"),this._measurements={x:0,y:0,width:0,height:0},this._cachedImage=null,this.loaded=!1}get canvas(){return this._canvas}get size(){return[this._measurements.width,this._measurements.height]}get viewOffset(){return[this._measurements.x,this._measurements.y]}loadString(t,e){this._cachedImage=null;const n=r(t,e);this._svgTag=n,this._measurements={width:n.viewBox.baseVal.width,height:n.viewBox.baseVal.height,x:n.viewBox.baseVal.x,y:n.viewBox.baseVal.y}}loadSVG(t,e,n){this.loadString(t,e),this._createSVGImage(n)}_createSVGImage(t){null===this._cachedImage&&(this._cachedImage=new Image);const e=this._cachedImage;e.onload=()=>{this.loaded=!0,t&&t()};const n=this.toString(!0);e.src=`data:image/svg+xml;utf8,${encodeURIComponent(n)}`,this.loaded=!1}toString(t){return i(this._svgTag,t)}draw(t){if(!this.loaded)throw new Error("SVG image has not finished loading");this._drawFromImage(t)}_drawFromImage(t){if(null===this._cachedImage)return;const e=Number.isFinite(t)?t:1,n=this._measurements;this._canvas.width=n.width*e,this._canvas.height=n.height*e,this._canvas.width<=0||this._canvas.height<=0||this._cachedImage.naturalWidth<=0||this._cachedImage.naturalHeight<=0||(this._context.clearRect(0,0,this._canvas.width,this._canvas.height),this._context.setTransform(e,0,0,e,0,0),this._context.drawImage(this._cachedImage,0,0))}}},function(t,e,n){const r=n(233),i=n(49),s=n(234),o=function(t){return Math.round(1e4*t)/1e4},a=function(t){let e=r.identity();const n=t.attributes&&t.attributes.transform&&t.attributes.transform.value;if(!n)return e;const i=n.split(/\)\s*/g);for(const t of i){if(!t)break;const n=t.split(/\(\s*/),i=n[0].trim(),o=n[1].split(/[\s,]+/g);for(let t=0;t<o.length;t++)o[t]=parseFloat(o[t]);switch(i){case"matrix":e=r.compose(e,{a:o[0],b:o[1],c:o[2],d:o[3],e:o[4],f:o[5]});break;case"rotate":e=r.compose(e,r.rotateDEG(o[0],o[1]||0,o[2]||0));break;case"translate":e=r.compose(e,r.translate(o[0],o[1]||0));break;case"scale":e=r.compose(e,r.scale(o[0],o[1]||o[0]));break;case"skewX":e=r.compose(e,r.skewDEG(o[0],0));break;case"skewY":e=r.compose(e,r.skewDEG(0,o[0]));break;default:s.error(`Couldn't parse: ${i}`)}}return e},c=function(t){const e=t.a,n=t.b,r=t.c,i=t.d,s=e*i-n*r;if(0!==e||0!==n){const t=Math.sqrt(e*e+n*n);return{x:t,y:s/t}}if(0!==r||0!==i){const t=Math.sqrt(r*r+i*i);return{x:s/t,y:t}}return{x:0,y:0}},u=function(t,e,n,r){n=-n*Math.PI/180;const i=r.a,s=-r.c,o=-r.b,a=r.d,c=i*a-s*o;if(0===c)return null;const u=Math.sin(n),l=Math.cos(n),h=Math.sin(2*n),d=l*l/t/t+u*u/e/e,p=h/t/t-h/e/e,f=u*u/t/t+l*l/e/e,m=d*a*a-p*a*o+f*o*o,g=-2*d*s*a+p*i*a+p*s*o-2*f*i*o,b=d*s*s-p*i*s+f*i*i,y=Math.sqrt(2)*Math.sqrt((m+b-Math.sqrt(m*m+g*g-2*m*b+b*b))/(-g*g+4*m*b)),v=1/Math.sqrt(m+b-1/y/y);let w=(m-1/y/y)/(1/v/v-1/y/y);w<0&&Math.abs(w)<1e-8&&(w=0),w=Math.sqrt(w),Math.abs(1-w)<1e-8&&(w=1);let T=Math.asin(w);w=g/(1/y/y-1/v/v);const E=-T;return Math.abs(Math.sin(2*E)-w)<Math.abs(Math.sin(2*T)-w)&&(T=E),{radiusX:y*c,radiusY:v*c,rotation:180*-T/Math.PI}},l=["circle","ellipse","image","line","path","polygon","polyline","rect","text","use"],h=["a","defs","g","marker","glyph","missing-glyph","pattern","svg","switch","symbol"],d=function(t,e){return Math.sqrt((t*t+e*e)/2)},p=function(t,e,n,s){const a=function(t,e,r,s,o,a){let c,u=i.get(t,e);if(null===u?a?(c=a,/%\s*$/.test(c)&&(u=a,c=parseFloat(u))):c=s?null:r?"":0:c=r?u:parseFloat(u),/%\s*$/.test(u)){return c/100*(o?1:n[/x|^width/.test(e)?"width":"height"])}return c},u=function(t,e,n,r,i,s,o){return e=a(t,e||"x",!1,r,i,s),n=a(t,n||"y",!1,r,i,o),!r||null!==e&&null!==n?{x:e,y:n}:null};let l=e.getElementsByTagName("defs");0===l.length?(l=i.create("defs"),e.appendChild(l)):l=l[0];const h=e.getElementById(t);if(!h)return;const p="radialgradient"===h.tagName.toLowerCase(),f=e.getElementById(t).cloneNode(!0);let m=r.toString(s);m=m.substring(8,m.length-1);const g=`${t}-${m}`;if(f.setAttribute("id",g),e.getElementById(g))return`url(#${g})`;const b="userSpaceOnUse"!==a(f,"gradientUnits",!0);let y,v,w,T;if(p)y=u(f,"cx","cy",!1,b,"50%","50%"),w=a(f,"r",!1,!1,b,"50%"),T=u(f,"fx","fy",!0,b);else if(y=u(f,"x1","y1",!1,b),v=u(f,"x2","y2",!1,b,"1"),y.x===v.x&&y.y===v.y){const t=f.getElementsByTagName("stop");return t.length&&t[t.length-1].attributes&&t[t.length-1].attributes["stop-color"]?t[t.length-1].attributes["stop-color"].value:null}if(b){const t=r.compose(r.translate(n.x,n.y),r.scale(n.width,n.height));y=r.applyToPoint(t,y),v&&(v=r.applyToPoint(t,v)),w&&(w=d(n.width,n.height)*w),T&&(T=r.applyToPoint(t,T))}if(p){y=r.applyToPoint(s,y);const t=c(s);w=d(t.x,t.y)*w,T&&(T=r.applyToPoint(s,T))}else{const t=(t,e)=>t.x*e.x+t.y*e.y,e=(t,e)=>({x:t*e.x,y:t*e.y}),n=(t,e)=>({x:t.x+e.x,y:t.y+e.y}),i=(t,e)=>({x:t.x-e.x,y:t.y-e.y});let o=Math.abs(y.x-v.x)<1e-8?n(y,{x:1,y:(y.x-v.x)/(v.y-y.y)}):n(y,{x:(v.y-y.y)/(y.x-v.x),y:1});o=r.applyToPoint(s,o),y=r.applyToPoint(s,y),v=r.applyToPoint(s,v);const a=i(o,y),c=i(v,y),u=Math.abs(a.x)<1e-8?{x:1,y:-a.x/a.y}:{x:-a.y/a.x,y:1},l=e(t(c,u)/t(u,u),u);v={x:y.x+l.x,y:y.y+l.y}}return p?(f.setAttribute("cx",o(y.x)),f.setAttribute("cy",o(y.y)),f.setAttribute("r",o(w)),T&&(f.setAttribute("fx",o(T.x)),f.setAttribute("fy",o(T.y)))):(f.setAttribute("x1",o(y.x)),f.setAttribute("y1",o(y.y)),f.setAttribute("x2",o(v.x)),f.setAttribute("y2",o(v.y))),f.setAttribute("gradientUnits","userSpaceOnUse"),l.appendChild(f),`url(#${g})`},f=(t,e)=>{const n=t&&t.match(/\((?:["'#]*)([^"')]+)/),r=n&&n[1];return r&&e?r.replace(`${e.location.href.split("#")[0]}#`,""):r},m=Object.create(null);let g=null,b=null,y=null;t.exports=function(t,e,n){const s=r.identity(),v=(s,w,T,E,A)=>{if(function(t){return t.tagName&&h.includes(t.tagName.toLowerCase())}(s)){s.attributes["stroke-width"]&&(T=s.attributes["stroke-width"].value),s.attributes&&(s.attributes.fill&&(E=s.attributes.fill.value),s.attributes.stroke&&(A=s.attributes.stroke.value));for(let t=0;t<s.childNodes.length;t++)v(s.childNodes[t],r.compose(w,a(s)),T,E,A);s.removeAttribute("transform"),s.removeAttribute("stroke-width"),s.removeAttribute("fill"),s.removeAttribute("stroke")}else if(function(t,e){return!!t.attributes&&(e=t.attributes["stroke-width"]?Number(t.attributes["stroke-width"].value):Number(e))&&t.tagName&&"path"===t.tagName.toLowerCase()&&t.attributes.d&&t.attributes.d.value}(s,T)){if(s.attributes["stroke-width"]&&(T=s.attributes["stroke-width"].value),s.attributes.fill&&(E=s.attributes.fill.value),s.attributes.stroke&&(A=s.attributes.stroke.value),w=r.compose(w,a(s)),r.toString(w)===r.toString(r.identity()))return s.removeAttribute("transform"),s.setAttribute("stroke-width",T),E&&s.setAttribute("fill",E),void(A&&s.setAttribute("stroke",A));const l=f(E,e),h=f(A,e);if(l||h){const r=n||((t,e)=>{const n=t.attributes.d.value;if(Object.prototype.hasOwnProperty.call(m,n))return m[n];if(!g){const t=e.document;g=t.createElement("span"),b=t.createElementNS(i.svg,"svg"),y=t.createElementNS(i.svg,"path"),g.className="scratch-svg-renderer-bbox",g.style.visibility="hidden",g.style.position="absolute",g.style.top="-10000px",g.style.left="-10000px",g.ariaHidden=!0,b.appendChild(y),g.appendChild(b),document.body.appendChild(g)}y.setAttribute("d",n);const r=b.getBBox();return m[n]=r,r})(s,e);if(l){const e=p(l,t,r,w);e&&(E=e)}if(h){const e=p(h,t,r,w);e&&(A=e)}}s.setAttribute("d",function(t,e){if(!e||r.toString(e)===r.toString(r.identity()))return t;const n=t&&t.match(/[mlhvcsqtaz][^mlhvcsqtaz]*/gi);let i,s,a,l=!1,h={x:0,y:0},d={x:0,y:0},p="";const f=function(t,e){let n=+i[t];return l&&(n+=h[e]),n},m=function(t){return{x:f(t,"x"),y:f(t+1,"y")}},g=function(t){const n=r.applyToPoint(e,t);return`${o(n.x)} ${o(n.y)} `};for(let t=0,r=n&&n.length;t<r;t++){const r=n[t],b=r[0],y=b.toLowerCase();i=r.match(/[+-]?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g);const v=i&&i.length;switch(l=b===y,"z"!==s||/[mz]/.test(y)||(p+=`M ${h.x} ${h.y} `),y){case"m":case"l":{let t="m"===y;for(let e=0;e<v;e+=2)p+=t?"M ":"L ",h=m(e),p+=g(h),t&&(d=h,t=!1);a=h;break}case"h":case"v":{const t="h"===y?"x":"y";h={x:h.x,y:h.y};for(let e=0;e<v;e++)h[t]=f(e,t),p+=`L ${g(h)}`;a=h;break}case"c":for(let t=0;t<v;t+=6){const e=m(t);a=m(t+2),h=m(t+4),p+=`C ${g(e)}${g(a)}${g(h)}`}break;case"s":for(let t=0;t<v;t+=4){const e=/[cs]/.test(s)?{x:2*h.x-a.x,y:2*h.y-a.y}:h;a=m(t),h=m(t+2),p+=`C ${g(e)}${g(a)}${g(h)}`,s=y}break;case"q":for(let t=0;t<v;t+=4)a=m(t),h=m(t+2),p+=`Q ${g(a)}${g(h)}`;break;case"t":for(let t=0;t<v;t+=2)a=/[qt]/.test(s)?{x:2*h.x-a.x,y:2*h.y-a.y}:h,h=m(t),p+=`Q ${g(a)}${g(h)}`,s=y;break;case"a":for(let t=0;t<v;t+=7){h=m(t+5);const n=+i[t],r=+i[t+1],s=+i[t+2],a=+i[t+3];let l=+i[t+4];const d=u(n,r,s,e),f=c(e);d?((f.x>0&&f.y<0||f.x<0&&f.y>0)&&(l^=1),p+=`A ${o(Math.abs(d.radiusX))} ${o(Math.abs(d.radiusY))} ${o(d.rotation)} ${a} ${l} ${g(h)}`):p+=`L ${g(h)}`}break;case"z":p+="Z ",h=d}s=y}return p}(s.attributes.d.value,w)),s.removeAttribute("transform");const v=c(w);s.setAttribute("stroke-width",d(v.x,v.y)*T),E&&s.setAttribute("fill",E),A&&s.setAttribute("stroke",A)}else(function(t){return t.tagName&&l.includes(t.tagName.toLowerCase())})(s)&&(T&&!s.attributes["stroke-width"]&&s.setAttribute("stroke-width",T),E&&!s.attributes.fill&&s.setAttribute("fill",E),A&&!s.attributes.stroke&&s.setAttribute("stroke",A),w=r.compose(w,a(s)),r.toString(w)===r.toString(r.identity())?s.removeAttribute("transform"):s.setAttribute("transform",r.toString(w)))};v(t,s,1)}},function(t,e,n){window,t.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";function r(t,e){return Array.isArray(e)?[t.a*e[0]+t.c*e[1]+t.e,t.b*e[0]+t.d*e[1]+t.f]:{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}function i(t,e){return e.map((function(e){return r(t,e)}))}function s(t){return{a:parseFloat(t.a),b:parseFloat(t.b),c:parseFloat(t.c),d:parseFloat(t.d),e:parseFloat(t.e),f:parseFloat(t.f)}}n.r(e);var o=/^matrix\(\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*\)$/i;function a(t){var e=t.match(o);if(null===e||e.length<7)throw new Error("'"+t+"' is not a matrix");return{a:parseFloat(e[1]),b:parseFloat(e[2]),c:parseFloat(e[3]),d:parseFloat(e[4]),e:parseFloat(e[5]),f:parseFloat(e[6])}}function c(){return{a:1,c:0,e:0,b:0,d:1,f:0}}function u(t){var e=t.a,n=t.b,r=t.c,i=t.d,s=t.e,o=t.f,a=e*i-n*r;return{a:i/a,b:n/-a,c:r/-a,d:e/a,e:(i*s-r*o)/-a,f:(n*s-e*o)/a}}var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h=function(t){return"number"==typeof t&&!isNaN(t)&&isFinite(t)},d=function(t){return null!=t&&"object"===(void 0===t?"undefined":l(t))};function p(t){return d(t)&&t.hasOwnProperty("a")&&h(t.a)&&t.hasOwnProperty("b")&&h(t.b)&&t.hasOwnProperty("c")&&h(t.c)&&t.hasOwnProperty("d")&&h(t.d)&&t.hasOwnProperty("e")&&h(t.e)&&t.hasOwnProperty("f")&&h(t.f)}function f(t){return void 0===t}function m(t){return{a:1,c:0,e:t,b:0,d:1,f:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0}}function g(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=function(t,e){return{a:t.a*e.a+t.c*e.b,c:t.a*e.c+t.c*e.d,e:t.a*e.e+t.c*e.f+t.e,b:t.b*e.a+t.d*e.b,d:t.b*e.c+t.d*e.d,f:t.b*e.e+t.d*e.f+t.f}};switch((e=Array.isArray(e[0])?e[0]:e).length){case 0:throw new Error("no matrices provided");case 1:return e[0];case 2:return r(e[0],e[1]);default:var i=function(t){return Array.isArray(t)?t:Array.from(t)}(e),s=i[0],o=i[1],a=i.slice(2),c=r(s,o);return g.apply(void 0,[c].concat(function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}(a)))}}function b(){return g.apply(void 0,arguments)}var y=Math.cos,v=Math.sin,w=Math.PI;function T(t,e,n){var r=y(t),i=v(t),s={a:r,c:-i,e:0,b:i,d:r,f:0};return f(e)||f(n)?s:g([m(e,n),s,m(-e,-n)])}function E(t){return T(t*w/180,arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0)}function A(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return f(e)&&(e=t),{a:t,c:0,e:0,b:0,d:e,f:0}}function k(t,e){return{a:1,c:t,e:0,b:e,d:1,f:0}}var I=Math.tan;function S(t,e){return{a:1,c:I(t),e:0,b:I(e),d:1,f:0}}function x(t,e){return S(t*Math.PI/180,e*Math.PI/180)}function O(t){return N(t)}function M(t){return N(t)}function N(t){return"matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")"}n.d(e,"applyToPoint",(function(){return r})),n.d(e,"applyToPoints",(function(){return i})),n.d(e,"fromObject",(function(){return s})),n.d(e,"fromString",(function(){return a})),n.d(e,"identity",(function(){return c})),n.d(e,"inverse",(function(){return u})),n.d(e,"isAffineMatrix",(function(){return p})),n.d(e,"rotate",(function(){return T})),n.d(e,"rotateDEG",(function(){return E})),n.d(e,"scale",(function(){return A})),n.d(e,"shear",(function(){return k})),n.d(e,"skew",(function(){return S})),n.d(e,"skewDEG",(function(){return x})),n.d(e,"toCSS",(function(){return O})),n.d(e,"toSVG",(function(){return M})),n.d(e,"toString",(function(){return N})),n.d(e,"transform",(function(){return g})),n.d(e,"compose",(function(){return b})),n.d(e,"translate",(function(){return m}))}])},function(t,e,n){const r=n(27);r.enable(),t.exports=r("scratch-svg-render")},function(t,e){let n=null;t.exports=()=>(n||(n=document.createElement("iframe"),n.className="scratch-svg-renderer-sandbox",n.sandbox="allow-same-origin",n.style.position="absolute",n.style.top="-10000px",n.style.left="-10000px",n.style.width="0",n.style.height="0",n.style.opacity="0",n.style.visibility="hidden",n.style.pointerEvents="none",n.tabIndex=-1,n.ariaHidden=!0,document.body.appendChild(n),n.contentDocument.open(),n.contentDocument.write('\n        <!DOCTYPE html>\n        <html>\n            <head>\n                <meta charset="utf-8">\n                <meta http-equiv="Content-Security-Policy" content="default-src \'none\'; style-src \'unsafe-inline\' data:; font-src data:; img-src data:">\n            </head>\n            <body></body>\n        </html>\n        '),n.contentDocument.close()),n.contentDocument.body)},function(t,e,n){let r;t.exports=function(){if(r)return r;r={"Sans Serif":n(237),Serif:n(238),Handwriting:n(239),Marker:n(240),Curly:n(241),Pixel:n(242),Scratch:n(243)};for(const t in r){const e=r[t];r[t]="@font-face {"+'font-family: "'.concat(t,'";src: url("data:font/woff2;base64,').concat(e,'");}')}if(!document.getElementById("scratch-font-styles")){let t="";for(const e in r)t+=r[e];const e=document.createElement("style");e.id="scratch-font-styles",e.textContent=t,document.body.insertBefore(e,document.body.firstChild)}return r}},function(t,e){t.exports=" "},function(t,e){t.exports=" "},function(t,e){t.exports=" "},function(t,e){t.exports=" "},function(t,e){t.exports=" "},function(t,e){t.exports=" "},function(t,e){t.exports=" "},function(t,e,n){const r=n(245);t.exports=class{constructor(t,e){this._makeImage=t||(()=>new Image),this._makeCanvas=e||(()=>document.createElement("canvas")),this.stageWidth=480,this.stageHeight=360}setStageSize(t,e){this.stageWidth=t,this.stageHeight=e}resize(t,e,n){const r=this._makeCanvas();r.width=e,r.height=t.height;let i=r.getContext("2d");i.imageSmoothingEnabled=!1,i.drawImage(t,0,0,r.width,r.height);const s=this._makeCanvas();return s.width=e,s.height=n,i=s.getContext("2d"),i.imageSmoothingEnabled=!1,i.drawImage(r,0,0,s.width,s.height),s}convertResolution1Bitmap(t,e){const n=this._makeImage();n.src=t,n.onload=()=>{e(null,this.resize(n,2*n.width,2*n.height).toDataURL())},n.onerror=()=>{e("Image load failed")}}getResizedWidthHeight(t,e){const n=this.stageWidth,r=this.stageHeight;if(t<=n&&e<=r)return{width:2*t,height:2*e};if(t<=2*n&&e<=2*r)return{width:t,height:e};const i=t/e;return i>=n/r?{width:2*n,height:2*n/i}:{width:2*r*i,height:2*r}}importBitmap(t,e){let n=t;return t instanceof ArrayBuffer&&(n=this.convertBinaryToDataURI(t,e)),new Promise(((t,e)=>{const r=this._makeImage();r.src=n,r.onload=()=>{const e=this.getResizedWidthHeight(r.width,r.height),n=this.resize(r,e.width,e.height).toDataURL();t(this.convertDataURIToBinary(n))},r.onerror=()=>{e("Image load failed")}}))}convertDataURIToBinary(t){const e=";base64,",n=t.indexOf(e)+8,r=t.substring(n),i=window.atob(r),s=i.length,o=new Uint8Array(new ArrayBuffer(s));for(let t=0;t<s;t++)o[t]=i.charCodeAt(t);return o}convertBinaryToDataURI(t,e){return`data:${e};base64,${r.fromByteArray(new Uint8Array(t))}`}}},function(t,e,n){"use strict";e.byteLength=function(t){return 3*t.length/4-c(t)},e.toByteArray=function(t){var e,n,r,o,a,u=t.length;o=c(t),a=new s(3*u/4-o),n=o>0?u-4:u;var l=0;for(e=0;e<n;e+=4)r=i[t.charCodeAt(e)]<<18|i[t.charCodeAt(e+1)]<<12|i[t.charCodeAt(e+2)]<<6|i[t.charCodeAt(e+3)],a[l++]=r>>16&255,a[l++]=r>>8&255,a[l++]=255&r;2===o?(r=i[t.charCodeAt(e)]<<2|i[t.charCodeAt(e+1)]>>4,a[l++]=255&r):1===o&&(r=i[t.charCodeAt(e)]<<10|i[t.charCodeAt(e+1)]<<4|i[t.charCodeAt(e+2)]>>2,a[l++]=r>>8&255,a[l++]=255&r);return a},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,s="",o=[],a=16383,c=0,l=n-i;c<l;c+=a)o.push(u(t,c,c+a>l?l:c+a));1===i?(e=t[n-1],s+=r[e>>2],s+=r[e<<4&63],s+="=="):2===i&&(e=(t[n-2]<<8)+t[n-1],s+=r[e>>10],s+=r[e>>4&63],s+=r[e<<2&63],s+="=");return o.push(s),o.join("")};for(var r=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=o[a],i[o.charCodeAt(a)]=a;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function u(t,e,n){for(var i,s,o=[],a=e;a<n;a+=3)i=(t[a]<<16)+(t[a+1]<<8)+t[a+2],o.push(r[(s=i)>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e,n){const r=n(75),i=n(48),s={sanitizeByteStream:function(t){const e=new TextDecoder,n=new TextEncoder,r=s.sanitizeSvgText(e.decode(t));return n.encode(r)}},o=`<!${"-".repeat(2)}`,a=`${"-".repeat(2)}>`,c=new RegExp(`${o}rotationCenter:(-?[\\d\\.]+):(-?[\\d\\.]+)${a}$`);s.sanitizeSvgText=function(t){let e=i.sanitize(t,{USE_PROFILES:{svg:!0}});e.indexOf("]&gt;")>=0&&(e=e.substring(5,e.length)),e=r(e);const n=t.match(c);return n&&(e+=n[0]),e},t.exports=s},function(t,e){t.exports=t=>{const e=(new TextDecoder).decode(t),n=(new DOMParser).parseFromString(e,"image/svg+xml"),r=n.documentElement;let i=!1;if(i=(t=>"100%"===t.getAttribute("width")&&"100%"===t.getAttribute("height")&&(t.removeAttribute("width"),t.removeAttribute("height"),!0))(r)||i,i=(t=>{let e=!1;const n=t=>{"rect"===t.tagName&&(t.hasAttribute("rx")&&!t.hasAttribute("ry")?(e=!0,t.setAttribute("ry",t.getAttribute("rx"))):t.hasAttribute("ry")&&!t.hasAttribute("rx")&&(e=!0,t.setAttribute("rx",t.getAttribute("ry"))));const r=t.childNodes;if(r)for(let t=0;t<r.length;t++)n(r[t])};return n(t),e})(r)||i,i){const t=(new XMLSerializer).serializeToString(n);return(new TextEncoder).encode(t)}return t}},function(t,e){const n=function(t,e,n){const r=n?[t.getTargetById(n)]:t.targets,i=[];for(let t=0;t<r.length;t++){const n=r[t].sprite[e];for(let t=0;t<n.length;t++){const e=n[t],r=e.broken?e.broken.asset:e.asset;r&&i.push({fileName:"".concat(r.assetId,".").concat(r.dataFormat),fileContent:r.data})}}return i};t.exports={serializeSounds:function(t,e){return n(t,"sounds",e)},serializeCostumes:function(t,e){return n(t,"costumes",e)}}},function(t,e){!function(t){"use strict";var e,n=t.Uint8Array,r=t.HTMLCanvasElement,i=r&&r.prototype,s=/\s*;\s*base64\s*(?:;|$)/i,o="toDataURL",a=function(t){for(var r,i,s=t.length,o=new n(s/4*3|0),a=0,c=0,u=[0,0],l=0,h=0;s--;)i=t.charCodeAt(a++),255!==(r=e[i-43])&&undefined!==r&&(u[1]=u[0],u[0]=i,h=h<<6|r,4===++l&&(o[c++]=h>>>16,61!==u[1]&&(o[c++]=h>>>8),61!==u[0]&&(o[c++]=h),l=0));return o};n&&(e=new n([62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,0,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51])),!r||i.toBlob&&i.toBlobHD||(i.toBlob||(i.toBlob=function(t,e){if(e||(e="image/png"),this.mozGetAsFile)t(this.mozGetAsFile("canvas",e));else if(this.msToBlob&&/^\s*image\/png\s*(?:$|;)/i.test(e))t(this.msToBlob());else{var r,i=Array.prototype.slice.call(arguments,1),c=this[o].apply(this,i),u=c.indexOf(","),l=c.substring(u+1),h=s.test(c.substring(0,u));Blob.fake?((r=new Blob).encoding=h?"base64":"URI",r.data=l,r.size=l.length):n&&(r=h?new Blob([a(l)],{type:e}):new Blob([decodeURIComponent(l)],{type:e})),t(r)}}),!i.toBlobHD&&i.toDataURLHD?i.toBlobHD=function(){o="toDataURLHD";var t=this.toBlob();return o="toDataURL",t}:i.toBlobHD=i.toBlob)}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content||this)},function(t,e,n){(function(e){var r=n(251);t.exports=function(t,n,i){if("string"==typeof t)return i(null,[t,null]);if(!e.isBuffer(t))try{t=new e(t)}catch(t){return i("Input must be a Buffer or a string.")}var s=t.slice(0,3).join(" "),o=!1,a=!1;if(0===s.indexOf("83 99 114")&&(o=!0),0===s.indexOf("80 75")&&(a=!0),!a&&!o){return i(null,[(new TextDecoder).decode(t),null])}if(o)return i("Parser only supports Scratch 2.X and above");r(t,n,i)}}).call(this,n(16).Buffer)},function(t,e,n){var r=n(19);t.exports=function(t,e,n){var i="Failed to unzip and extract project.json, with error: ";return r.loadAsync(t).then((function(t){const r=e?t.file(/^([^/]*\/)?sprite\.json$/)[0]:t.file(/^([^/]*\/)?project\.json$/)[0];return r?r.async("string").then((function(e){return n(null,[e,t])})):n(i+"missing project or sprite json")})).catch((function(t){return n(i+t)}))}},function(t,e,n){const r=n(60);t.exports=function(t,e){var n;try{n=r.parse(t.replace(/(\\+)(b|u0008)/g,((t,e,n)=>e.length%2?t.replace("\\"+n,""):t)))}catch(t){return e(t.toString())}return e(null,n)}},function(t,e){t.exports=function(t,e,n){if("objName"in e)return e.projectVersion=2,n(null,e);if(t){if("name"in e)return e.projectVersion=3,n(null,e)}else if("targets"in e)return e.projectVersion=3,n(null,e);n(new Error("Could not parse as a valid SB2 or SB3 project."))}},function(t,e){(function(e){t.exports=e}).call(this,{})},function(t,e){const n="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#%()*+,-./:;=?@[]^_`{|}~",r=t=>{let e="";for(;t>=0;)e=n[t%77]+e,t=Math.floor(t/77)-1;return e};class i{constructor(){this.generatedIds=new Map,this.references=new Map,this.skippedIds=new Set,this.skippedIds.add("of")}skip(t){this.skippedIds.add(t)}addReference(t){const e=this.references.get(t)||0;this.references.set(t,e+1)}generateNewIds(){const t=Array.from(this.references.entries());t.sort(((t,e)=>e[1]-t[1]));let e=0;for(const n of t){const t=n[0];let i=r(e);for(;this.skippedIds.has(i);)e++,i=r(e);this.generatedIds.set(t,i),e++}}getNewId(t){return this.generatedIds.has(t)?this.generatedIds.get(t):t}}t.exports=t=>{const e=new i;for(const n of t.targets){for(const t of Object.keys(n.variables))e.skip(t);for(const t of Object.keys(n.lists))e.skip(t);for(const t of Object.keys(n.broadcasts))e.skip(t);for(const t of Object.keys(n.blocks)){const r=n.blocks[t];if(e.addReference(t),!Array.isArray(r)){r.parent&&e.addReference(r.parent),r.next&&e.addReference(r.next),r.comment&&e.addReference(r.comment);for(const t of Object.values(r.inputs))for(let n=1;n<t.length;n++){const r=t[n];"string"==typeof r&&e.addReference(r)}}}for(const t of Object.keys(n.comments)){const r=n.comments[t];e.addReference(t),r.blockId&&e.addReference(r.blockId)}}e.generateNewIds();for(const n of t.targets){const t={},r={};for(const r of Object.keys(n.blocks)){const i=n.blocks[r];if(t[e.getNewId(r)]=i,!Array.isArray(i)){i.parent&&(i.parent=e.getNewId(i.parent)),i.next&&(i.next=e.getNewId(i.next)),i.comment&&(i.comment=e.getNewId(i.comment));for(const t of Object.values(i.inputs))for(let n=1;n<t.length;n++){const r=t[n];"string"==typeof r&&(t[n]=e.getNewId(r))}}}for(const t of Object.keys(n.comments)){const i=n.comments[t];r[e.getNewId(t)]=i,i.blockId&&(i.blockId=e.getNewId(i.blockId))}n.blocks=t,n.comments=r}}},function(t,e,n){const r=n(9),i={"forward:":{opcode:"motion_movesteps",argMap:[{type:"input",inputOp:"math_number",inputName:"STEPS"}]},"turnRight:":{opcode:"motion_turnright",argMap:[{type:"input",inputOp:"math_number",inputName:"DEGREES"}]},"turnLeft:":{opcode:"motion_turnleft",argMap:[{type:"input",inputOp:"math_number",inputName:"DEGREES"}]},"heading:":{opcode:"motion_pointindirection",argMap:[{type:"input",inputOp:"math_angle",inputName:"DIRECTION"}]},"pointTowards:":{opcode:"motion_pointtowards",argMap:[{type:"input",inputOp:"motion_pointtowards_menu",inputName:"TOWARDS"}]},"gotoX:y:":{opcode:"motion_gotoxy",argMap:[{type:"input",inputOp:"math_number",inputName:"X"},{type:"input",inputOp:"math_number",inputName:"Y"}]},"gotoSpriteOrMouse:":{opcode:"motion_goto",argMap:[{type:"input",inputOp:"motion_goto_menu",inputName:"TO"}]},"glideSecs:toX:y:elapsed:from:":{opcode:"motion_glidesecstoxy",argMap:[{type:"input",inputOp:"math_number",inputName:"SECS"},{type:"input",inputOp:"math_number",inputName:"X"},{type:"input",inputOp:"math_number",inputName:"Y"}]},"changeXposBy:":{opcode:"motion_changexby",argMap:[{type:"input",inputOp:"math_number",inputName:"DX"}]},"xpos:":{opcode:"motion_setx",argMap:[{type:"input",inputOp:"math_number",inputName:"X"}]},"changeYposBy:":{opcode:"motion_changeyby",argMap:[{type:"input",inputOp:"math_number",inputName:"DY"}]},"ypos:":{opcode:"motion_sety",argMap:[{type:"input",inputOp:"math_number",inputName:"Y"}]},bounceOffEdge:{opcode:"motion_ifonedgebounce",argMap:[]},setRotationStyle:{opcode:"motion_setrotationstyle",argMap:[{type:"field",fieldName:"STYLE"}]},xpos:{opcode:"motion_xposition",argMap:[]},ypos:{opcode:"motion_yposition",argMap:[]},heading:{opcode:"motion_direction",argMap:[]},scrollRight:{opcode:"motion_scroll_right",argMap:[{type:"input",inputOp:"math_number",inputName:"DISTANCE"}]},scrollUp:{opcode:"motion_scroll_up",argMap:[{type:"input",inputOp:"math_number",inputName:"DISTANCE"}]},scrollAlign:{opcode:"motion_align_scene",argMap:[{type:"field",fieldName:"ALIGNMENT"}]},xScroll:{opcode:"motion_xscroll",argMap:[]},yScroll:{opcode:"motion_yscroll",argMap:[]},"say:duration:elapsed:from:":{opcode:"looks_sayforsecs",argMap:[{type:"input",inputOp:"text",inputName:"MESSAGE"},{type:"input",inputOp:"math_number",inputName:"SECS"}]},"say:":{opcode:"looks_say",argMap:[{type:"input",inputOp:"text",inputName:"MESSAGE"}]},"think:duration:elapsed:from:":{opcode:"looks_thinkforsecs",argMap:[{type:"input",inputOp:"text",inputName:"MESSAGE"},{type:"input",inputOp:"math_number",inputName:"SECS"}]},"think:":{opcode:"looks_think",argMap:[{type:"input",inputOp:"text",inputName:"MESSAGE"}]},show:{opcode:"looks_show",argMap:[]},hide:{opcode:"looks_hide",argMap:[]},hideAll:{opcode:"looks_hideallsprites",argMap:[]},"lookLike:":{opcode:"looks_switchcostumeto",argMap:[{type:"input",inputOp:"looks_costume",inputName:"COSTUME"}]},nextCostume:{opcode:"looks_nextcostume",argMap:[]},startScene:{opcode:"looks_switchbackdropto",argMap:[{type:"input",inputOp:"looks_backdrops",inputName:"BACKDROP"}]},"changeGraphicEffect:by:":{opcode:"looks_changeeffectby",argMap:[{type:"field",fieldName:"EFFECT"},{type:"input",inputOp:"math_number",inputName:"CHANGE"}]},"setGraphicEffect:to:":{opcode:"looks_seteffectto",argMap:[{type:"field",fieldName:"EFFECT"},{type:"input",inputOp:"math_number",inputName:"VALUE"}]},filterReset:{opcode:"looks_cleargraphiceffects",argMap:[]},"changeSizeBy:":{opcode:"looks_changesizeby",argMap:[{type:"input",inputOp:"math_number",inputName:"CHANGE"}]},"setSizeTo:":{opcode:"looks_setsizeto",argMap:[{type:"input",inputOp:"math_number",inputName:"SIZE"}]},"changeStretchBy:":{opcode:"looks_changestretchby",argMap:[{type:"input",inputOp:"math_number",inputName:"CHANGE"}]},"setStretchTo:":{opcode:"looks_setstretchto",argMap:[{type:"input",inputOp:"math_number",inputName:"STRETCH"}]},comeToFront:{opcode:"looks_gotofrontback",argMap:[]},"goBackByLayers:":{opcode:"looks_goforwardbackwardlayers",argMap:[{type:"input",inputOp:"math_integer",inputName:"NUM"}]},costumeIndex:{opcode:"looks_costumenumbername",argMap:[]},costumeName:{opcode:"looks_costumenumbername",argMap:[]},sceneName:{opcode:"looks_backdropnumbername",argMap:[]},scale:{opcode:"looks_size",argMap:[]},startSceneAndWait:{opcode:"looks_switchbackdroptoandwait",argMap:[{type:"input",inputOp:"looks_backdrops",inputName:"BACKDROP"}]},nextScene:{opcode:"looks_nextbackdrop",argMap:[]},backgroundIndex:{opcode:"looks_backdropnumbername",argMap:[]},"playSound:":{opcode:"sound_play",argMap:[{type:"input",inputOp:"sound_sounds_menu",inputName:"SOUND_MENU"}]},doPlaySoundAndWait:{opcode:"sound_playuntildone",argMap:[{type:"input",inputOp:"sound_sounds_menu",inputName:"SOUND_MENU"}]},stopAllSounds:{opcode:"sound_stopallsounds",argMap:[]},playDrum:{opcode:"music_playDrumForBeats",argMap:[{type:"input",inputOp:"music_menu_DRUM",inputName:"DRUM"},{type:"input",inputOp:"math_number",inputName:"BEATS"}]},"drum:duration:elapsed:from:":{opcode:"music_midiPlayDrumForBeats",argMap:[{type:"input",inputOp:"math_number",inputName:"DRUM"},{type:"input",inputOp:"math_number",inputName:"BEATS"}]},"rest:elapsed:from:":{opcode:"music_restForBeats",argMap:[{type:"input",inputOp:"math_number",inputName:"BEATS"}]},"noteOn:duration:elapsed:from:":{opcode:"music_playNoteForBeats",argMap:[{type:"input",inputOp:"note",inputName:"NOTE"},{type:"input",inputOp:"math_number",inputName:"BEATS"}]},"instrument:":{opcode:"music_setInstrument",argMap:[{type:"input",inputOp:"music_menu_INSTRUMENT",inputName:"INSTRUMENT"}]},"midiInstrument:":{opcode:"music_midiSetInstrument",argMap:[{type:"input",inputOp:"math_number",inputName:"INSTRUMENT"}]},"changeVolumeBy:":{opcode:"sound_changevolumeby",argMap:[{type:"input",inputOp:"math_number",inputName:"VOLUME"}]},"setVolumeTo:":{opcode:"sound_setvolumeto",argMap:[{type:"input",inputOp:"math_number",inputName:"VOLUME"}]},volume:{opcode:"sound_volume",argMap:[]},"changeTempoBy:":{opcode:"music_changeTempo",argMap:[{type:"input",inputOp:"math_number",inputName:"TEMPO"}]},"setTempoTo:":{opcode:"music_setTempo",argMap:[{type:"input",inputOp:"math_number",inputName:"TEMPO"}]},tempo:{opcode:"music_getTempo",argMap:[]},clearPenTrails:{opcode:"pen_clear",argMap:[]},stampCostume:{opcode:"pen_stamp",argMap:[]},putPenDown:{opcode:"pen_penDown",argMap:[]},putPenUp:{opcode:"pen_penUp",argMap:[]},"penColor:":{opcode:"pen_setPenColorToColor",argMap:[{type:"input",inputOp:"colour_picker",inputName:"COLOR"}]},"changePenHueBy:":{opcode:"pen_changePenHueBy",argMap:[{type:"input",inputOp:"math_number",inputName:"HUE"}]},"setPenHueTo:":{opcode:"pen_setPenHueToNumber",argMap:[{type:"input",inputOp:"math_number",inputName:"HUE"}]},"changePenShadeBy:":{opcode:"pen_changePenShadeBy",argMap:[{type:"input",inputOp:"math_number",inputName:"SHADE"}]},"setPenShadeTo:":{opcode:"pen_setPenShadeToNumber",argMap:[{type:"input",inputOp:"math_number",inputName:"SHADE"}]},"changePenSizeBy:":{opcode:"pen_changePenSizeBy",argMap:[{type:"input",inputOp:"math_number",inputName:"SIZE"}]},"penSize:":{opcode:"pen_setPenSizeTo",argMap:[{type:"input",inputOp:"math_number",inputName:"SIZE"}]},senseVideoMotion:{opcode:"videoSensing_videoOn",argMap:[{type:"input",inputOp:"videoSensing_menu_ATTRIBUTE",inputName:"ATTRIBUTE"},{type:"input",inputOp:"videoSensing_menu_SUBJECT",inputName:"SUBJECT"}]},whenGreenFlag:{opcode:"event_whenflagclicked",argMap:[]},whenKeyPressed:{opcode:"event_whenkeypressed",argMap:[{type:"field",fieldName:"KEY_OPTION"}]},whenClicked:{opcode:"event_whenthisspriteclicked",argMap:[]},whenSceneStarts:{opcode:"event_whenbackdropswitchesto",argMap:[{type:"field",fieldName:"BACKDROP"}]},whenSensorGreaterThan:t=>{let[,e]=t;return"video motion"===e?{opcode:"videoSensing_whenMotionGreaterThan",argMap:[{},{type:"input",inputOp:"math_number",inputName:"REFERENCE"}]}:{opcode:"event_whengreaterthan",argMap:[{type:"field",fieldName:"WHENGREATERTHANMENU"},{type:"input",inputOp:"math_number",inputName:"VALUE"}]}},whenIReceive:{opcode:"event_whenbroadcastreceived",argMap:[{type:"field",fieldName:"BROADCAST_OPTION",variableType:r.BROADCAST_MESSAGE_TYPE}]},"broadcast:":{opcode:"event_broadcast",argMap:[{type:"input",inputOp:"event_broadcast_menu",inputName:"BROADCAST_INPUT",variableType:r.BROADCAST_MESSAGE_TYPE}]},doBroadcastAndWait:{opcode:"event_broadcastandwait",argMap:[{type:"input",inputOp:"event_broadcast_menu",inputName:"BROADCAST_INPUT",variableType:r.BROADCAST_MESSAGE_TYPE}]},"wait:elapsed:from:":{opcode:"control_wait",argMap:[{type:"input",inputOp:"math_positive_number",inputName:"DURATION"}]},doRepeat:{opcode:"control_repeat",argMap:[{type:"input",inputOp:"math_whole_number",inputName:"TIMES"},{type:"input",inputOp:"substack",inputName:"SUBSTACK"}]},doForever:{opcode:"control_forever",argMap:[{type:"input",inputOp:"substack",inputName:"SUBSTACK"}]},doIf:{opcode:"control_if",argMap:[{type:"input",inputOp:"boolean",inputName:"CONDITION"},{type:"input",inputOp:"substack",inputName:"SUBSTACK"}]},doIfElse:{opcode:"control_if_else",argMap:[{type:"input",inputOp:"boolean",inputName:"CONDITION"},{type:"input",inputOp:"substack",inputName:"SUBSTACK"},{type:"input",inputOp:"substack",inputName:"SUBSTACK2"}]},doWaitUntil:{opcode:"control_wait_until",argMap:[{type:"input",inputOp:"boolean",inputName:"CONDITION"}]},doUntil:{opcode:"control_repeat_until",argMap:[{type:"input",inputOp:"boolean",inputName:"CONDITION"},{type:"input",inputOp:"substack",inputName:"SUBSTACK"}]},doWhile:{opcode:"control_while",argMap:[{type:"input",inputOp:"boolean",inputName:"CONDITION"},{type:"input",inputOp:"substack",inputName:"SUBSTACK"}]},doForLoop:{opcode:"control_for_each",argMap:[{type:"field",fieldName:"VARIABLE"},{type:"input",inputOp:"text",inputName:"VALUE"},{type:"input",inputOp:"substack",inputName:"SUBSTACK"}]},stopScripts:{opcode:"control_stop",argMap:[{type:"field",fieldName:"STOP_OPTION"}]},whenCloned:{opcode:"control_start_as_clone",argMap:[]},createCloneOf:{opcode:"control_create_clone_of",argMap:[{type:"input",inputOp:"control_create_clone_of_menu",inputName:"CLONE_OPTION"}]},deleteClone:{opcode:"control_delete_this_clone",argMap:[]},COUNT:{opcode:"control_get_counter",argMap:[]},INCR_COUNT:{opcode:"control_incr_counter",argMap:[]},CLR_COUNT:{opcode:"control_clear_counter",argMap:[]},warpSpeed:{opcode:"control_all_at_once",argMap:[{type:"input",inputOp:"substack",inputName:"SUBSTACK"}]},"touching:":{opcode:"sensing_touchingobject",argMap:[{type:"input",inputOp:"sensing_touchingobjectmenu",inputName:"TOUCHINGOBJECTMENU"}]},"touchingColor:":{opcode:"sensing_touchingcolor",argMap:[{type:"input",inputOp:"colour_picker",inputName:"COLOR"}]},"color:sees:":{opcode:"sensing_coloristouchingcolor",argMap:[{type:"input",inputOp:"colour_picker",inputName:"COLOR"},{type:"input",inputOp:"colour_picker",inputName:"COLOR2"}]},"distanceTo:":{opcode:"sensing_distanceto",argMap:[{type:"input",inputOp:"sensing_distancetomenu",inputName:"DISTANCETOMENU"}]},doAsk:{opcode:"sensing_askandwait",argMap:[{type:"input",inputOp:"text",inputName:"QUESTION"}]},answer:{opcode:"sensing_answer",argMap:[]},"keyPressed:":{opcode:"sensing_keypressed",argMap:[{type:"input",inputOp:"sensing_keyoptions",inputName:"KEY_OPTION"}]},mousePressed:{opcode:"sensing_mousedown",argMap:[]},mouseX:{opcode:"sensing_mousex",argMap:[]},mouseY:{opcode:"sensing_mousey",argMap:[]},soundLevel:{opcode:"sensing_loudness",argMap:[]},isLoud:{opcode:"sensing_loud",argMap:[]},setVideoState:{opcode:"videoSensing_videoToggle",argMap:[{type:"input",inputOp:"videoSensing_menu_VIDEO_STATE",inputName:"VIDEO_STATE"}]},setVideoTransparency:{opcode:"videoSensing_setVideoTransparency",argMap:[{type:"input",inputOp:"math_number",inputName:"TRANSPARENCY"}]},timer:{opcode:"sensing_timer",argMap:[]},timerReset:{opcode:"sensing_resettimer",argMap:[]},"getAttribute:of:":{opcode:"sensing_of",argMap:[{type:"field",fieldName:"PROPERTY"},{type:"input",inputOp:"sensing_of_object_menu",inputName:"OBJECT"}]},timeAndDate:{opcode:"sensing_current",argMap:[{type:"field",fieldName:"CURRENTMENU"}]},timestamp:{opcode:"sensing_dayssince2000",argMap:[]},getUserName:{opcode:"sensing_username",argMap:[]},getUserId:{opcode:"sensing_userid",argMap:[]},"+":{opcode:"operator_add",argMap:[{type:"input",inputOp:"math_number",inputName:"NUM1"},{type:"input",inputOp:"math_number",inputName:"NUM2"}]},"-":{opcode:"operator_subtract",argMap:[{type:"input",inputOp:"math_number",inputName:"NUM1"},{type:"input",inputOp:"math_number",inputName:"NUM2"}]},"*":{opcode:"operator_multiply",argMap:[{type:"input",inputOp:"math_number",inputName:"NUM1"},{type:"input",inputOp:"math_number",inputName:"NUM2"}]},"/":{opcode:"operator_divide",argMap:[{type:"input",inputOp:"math_number",inputName:"NUM1"},{type:"input",inputOp:"math_number",inputName:"NUM2"}]},"randomFrom:to:":{opcode:"operator_random",argMap:[{type:"input",inputOp:"math_number",inputName:"FROM"},{type:"input",inputOp:"math_number",inputName:"TO"}]},"<":{opcode:"operator_lt",argMap:[{type:"input",inputOp:"text",inputName:"OPERAND1"},{type:"input",inputOp:"text",inputName:"OPERAND2"}]},"=":{opcode:"operator_equals",argMap:[{type:"input",inputOp:"text",inputName:"OPERAND1"},{type:"input",inputOp:"text",inputName:"OPERAND2"}]},">":{opcode:"operator_gt",argMap:[{type:"input",inputOp:"text",inputName:"OPERAND1"},{type:"input",inputOp:"text",inputName:"OPERAND2"}]},"&":{opcode:"operator_and",argMap:[{type:"input",inputOp:"boolean",inputName:"OPERAND1"},{type:"input",inputOp:"boolean",inputName:"OPERAND2"}]},"|":{opcode:"operator_or",argMap:[{type:"input",inputOp:"boolean",inputName:"OPERAND1"},{type:"input",inputOp:"boolean",inputName:"OPERAND2"}]},not:{opcode:"operator_not",argMap:[{type:"input",inputOp:"boolean",inputName:"OPERAND"}]},"concatenate:with:":{opcode:"operator_join",argMap:[{type:"input",inputOp:"text",inputName:"STRING1"},{type:"input",inputOp:"text",inputName:"STRING2"}]},"letter:of:":{opcode:"operator_letter_of",argMap:[{type:"input",inputOp:"math_whole_number",inputName:"LETTER"},{type:"input",inputOp:"text",inputName:"STRING"}]},"stringLength:":{opcode:"operator_length",argMap:[{type:"input",inputOp:"text",inputName:"STRING"}]},"%":{opcode:"operator_mod",argMap:[{type:"input",inputOp:"math_number",inputName:"NUM1"},{type:"input",inputOp:"math_number",inputName:"NUM2"}]},rounded:{opcode:"operator_round",argMap:[{type:"input",inputOp:"math_number",inputName:"NUM"}]},"computeFunction:of:":{opcode:"operator_mathop",argMap:[{type:"field",fieldName:"OPERATOR"},{type:"input",inputOp:"math_number",inputName:"NUM"}]},readVariable:{opcode:"data_variable",argMap:[{type:"field",fieldName:"VARIABLE",variableType:r.SCALAR_TYPE}]},"getVar:":{opcode:"data_variable",argMap:[{type:"field",fieldName:"VARIABLE",variableType:r.SCALAR_TYPE}]},"setVar:to:":{opcode:"data_setvariableto",argMap:[{type:"field",fieldName:"VARIABLE",variableType:r.SCALAR_TYPE},{type:"input",inputOp:"text",inputName:"VALUE"}]},"changeVar:by:":{opcode:"data_changevariableby",argMap:[{type:"field",fieldName:"VARIABLE",variableType:r.SCALAR_TYPE},{type:"input",inputOp:"math_number",inputName:"VALUE"}]},"showVariable:":{opcode:"data_showvariable",argMap:[{type:"field",fieldName:"VARIABLE",variableType:r.SCALAR_TYPE}]},"hideVariable:":{opcode:"data_hidevariable",argMap:[{type:"field",fieldName:"VARIABLE",variableType:r.SCALAR_TYPE}]},"contentsOfList:":{opcode:"data_listcontents",argMap:[{type:"field",fieldName:"LIST",variableType:r.LIST_TYPE}]},"append:toList:":{opcode:"data_addtolist",argMap:[{type:"input",inputOp:"text",inputName:"ITEM"},{type:"field",fieldName:"LIST",variableType:r.LIST_TYPE}]},"deleteLine:ofList:":{opcode:"data_deleteoflist",argMap:[{type:"input",inputOp:"math_integer",inputName:"INDEX"},{type:"field",fieldName:"LIST",variableType:r.LIST_TYPE}]},"insert:at:ofList:":{opcode:"data_insertatlist",argMap:[{type:"input",inputOp:"text",inputName:"ITEM"},{type:"input",inputOp:"math_integer",inputName:"INDEX"},{type:"field",fieldName:"LIST",variableType:r.LIST_TYPE}]},"setLine:ofList:to:":{opcode:"data_replaceitemoflist",argMap:[{type:"input",inputOp:"math_integer",inputName:"INDEX"},{type:"field",fieldName:"LIST",variableType:r.LIST_TYPE},{type:"input",inputOp:"text",inputName:"ITEM"}]},"getLine:ofList:":{opcode:"data_itemoflist",argMap:[{type:"input",inputOp:"math_integer",inputName:"INDEX"},{type:"field",fieldName:"LIST",variableType:r.LIST_TYPE}]},"lineCountOfList:":{opcode:"data_lengthoflist",argMap:[{type:"field",fieldName:"LIST",variableType:r.LIST_TYPE}]},"list:contains:":{opcode:"data_listcontainsitem",argMap:[{type:"field",fieldName:"LIST",variableType:r.LIST_TYPE},{type:"input",inputOp:"text",inputName:"ITEM"}]},"showList:":{opcode:"data_showlist",argMap:[{type:"field",fieldName:"LIST",variableType:r.LIST_TYPE}]},"hideList:":{opcode:"data_hidelist",argMap:[{type:"field",fieldName:"LIST",variableType:r.LIST_TYPE}]},procDef:{opcode:"procedures_definition",argMap:[]},getParam:{opcode:"argument_reporter_string_number",argMap:[{type:"field",fieldName:"VALUE"}]},call:{opcode:"procedures_call",argMap:[]}},s=function(t,e,n){i["".concat(t).concat("").concat(e)]=n,i["".concat(t,".").concat(e)]=n},o="LEGO WeDo 2.0";s(o,"motorOnFor",{opcode:"wedo2_motorOnFor",argMap:[{type:"input",inputOp:"wedo2_menu_MOTOR_ID",inputName:"MOTOR_ID"},{type:"input",inputOp:"math_number",inputName:"DURATION"}]}),s(o,"motorOn",{opcode:"wedo2_motorOn",argMap:[{type:"input",inputOp:"wedo2_menu_MOTOR_ID",inputName:"MOTOR_ID"}]}),s(o,"motorOff",{opcode:"wedo2_motorOff",argMap:[{type:"input",inputOp:"wedo2_menu_MOTOR_ID",inputName:"MOTOR_ID"}]}),s(o,"startMotorPower",{opcode:"wedo2_startMotorPower",argMap:[{type:"input",inputOp:"wedo2_menu_MOTOR_ID",inputName:"MOTOR_ID"},{type:"input",inputOp:"math_number",inputName:"POWER"}]}),s(o,"setMotorDirection",{opcode:"wedo2_setMotorDirection",argMap:[{type:"input",inputOp:"wedo2_menu_MOTOR_ID",inputName:"MOTOR_ID"},{type:"input",inputOp:"wedo2_menu_MOTOR_DIRECTION",inputName:"MOTOR_DIRECTION"}]}),s(o,"setLED",{opcode:"wedo2_setLightHue",argMap:[{type:"input",inputOp:"math_number",inputName:"HUE"}]}),s(o,"playNote",{opcode:"wedo2_playNoteFor",argMap:[{type:"input",inputOp:"math_number",inputName:"NOTE"},{type:"input",inputOp:"math_number",inputName:"DURATION"}]}),s(o,"whenDistance",{opcode:"wedo2_whenDistance",argMap:[{type:"input",inputOp:"wedo2_menu_OP",inputName:"OP"},{type:"input",inputOp:"math_number",inputName:"REFERENCE"}]}),s(o,"whenTilted",{opcode:"wedo2_whenTilted",argMap:[{type:"input",inputOp:"wedo2_menu_TILT_DIRECTION_ANY",inputName:"TILT_DIRECTION_ANY"}]}),s(o,"getDistance",{opcode:"wedo2_getDistance",argMap:[]}),s(o,"isTilted",{opcode:"wedo2_isTilted",argMap:[{type:"input",inputOp:"wedo2_menu_TILT_DIRECTION_ANY",inputName:"TILT_DIRECTION_ANY"}]}),s(o,"getTilt",{opcode:"wedo2_getTiltAngle",argMap:[{type:"input",inputOp:"wedo2_menu_TILT_DIRECTION",inputName:"TILT_DIRECTION"}]}),t.exports=i},function(t,e){const n=new Map;n.set("text","https://extensions.turbowarp.org/lab/text.js"),n.set("audiostr","https://extensions.turbowarp.org/turboloader/audiostream.js"),t.exports=n},function(t,e,n){const r=n(17),i=n(259),s=n(10),o=n(23),a=n(25),c=n(265),u=n(266),l=n(84),h=n(270),d=n(32),p=n(26),f=n(271),m=n(272),g=n(85),b=n(87),y=n(86),v=s.v3.create(),w=new l,T=new l,E=new Uint8ClampedArray(4),A=new Uint8ClampedArray(4),k=[3,3],I=(t,e,n)=>(248&t[0])==(248&e[n+0])&&(248&t[1])==(248&e[n+1])&&(240&t[2])==(240&e[n+2]);let S;let x;class O extends r{static isSupported(t){try{t=t||document.createElement("canvas");const e={alpha:!0,stencil:!0,antialias:!1,powerPreference:O.powerPreference};return!!(t.getContext("webgl2",e)||t.getContext("webgl",e)||t.getContext("experimental-webgl",e))}catch(t){return!1}}static _getContext(t){const e={alpha:!0,stencil:!0,antialias:!1,powerPreference:O.powerPreference};return s.getContext(t,e)}constructor(t,e,r,i,g){super();const y=this._gl=O._getContext(t);if(!y)throw new Error("Could not get WebGL context: this browser or environment may not support WebGL.");this._useGpuMode=O.UseGpuModes.Automatic,this._allDrawables=[],this._allSkins=[],this._drawList=[],this._groupOrdering=[],this._layerGroups={},this._nextDrawableId=d.ID_NONE+1,this._nextSkinId=d.ID_NONE+1,this._projection=s.m4.identity(),this._shaderManager=new p(y),this._regionId=null,this._exitRegion=null,this._backgroundDrawRegionId={enter:()=>this._enterDrawBackground(),exit:()=>this._exitDrawBackground()},this._snapshotCallbacks=[],this._backgroundColor4f=[0,0,0,1],this._backgroundColor3b=new Uint8ClampedArray(3),this._penSkinId=null,this.useHighQualityRender=!1,this.offscreenTouching=!1,this.dirty=!0,this.overlayContainer=document.createElement("div"),this.overlayContainer.className="scratch-render-overlays",this._overlays=[],x||(x=document.createElement("style"),x.textContent=n(281),x.className="scratch-render-styles",document.head.appendChild(x)),this._createGeometry(),this.on(d.Events.NativeSizeChanged,this.onNativeSizeChanged),this.setBackgroundColor(1,1,1),this.setStageSize(e||-240,r||240,i||-180,g||180),this.resize(this._nativeSize[0],this._nativeSize[1]),y.disable(y.DEPTH_TEST),y.enable(y.BLEND),y.blendFunc(y.ONE,y.ONE_MINUS_SRC_ALPHA),this.allowPrivateSkinAccess=!0,this.maxTextureDimension=2048,this.customFonts={},this._customFontStyles=null,this.exports={twgl:s,SVGRenderer:o,Drawable:u,Skin:a,BitmapSkin:c,TextBubbleSkin:m,PenSkin:h,SVGSkin:f,CanvasMeasurementProvider:b,Rectangle:l}}setUseHighQualityRender(t){this.dirty=!0,this.useHighQualityRender=t,this.emit(d.Events.UseHighQualityRenderChanged,t),this._updateRenderQuality()}_updateRenderQuality(){if(null!==this._penSkinId){const t=this._allSkins[this._penSkinId];t&&(this.useHighQualityRender?t.setRenderQuality(this.canvas.width/this._nativeSize[0]):t.setRenderQuality(1))}for(const t of this._allDrawables)t&&t.setHighQuality(this.useHighQualityRender)}setPrivateSkinAccess(t){this.allowPrivateSkinAccess=t,this.emit(d.Events.AllowPrivateSkinAccessChanged,t)}setMaxTextureDimension(t){const e=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE);this.maxTextureDimension=Math.min(t,e)}get gl(){return this._gl}get canvas(){return this._gl&&this._gl.canvas}resize(t,e){const{canvas:n}=this._gl,r=window.devicePixelRatio||1,i=t*r,s=e*r;n.width===i&&n.height===s||(n.width=i,n.height=s,this._updateRenderQuality(),this._updateOverlays(),this.dirty=!0,this.draw())}setBackgroundColor(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;this.dirty=!0,this._backgroundColor4f[0]=t*r,this._backgroundColor4f[1]=e*r,this._backgroundColor4f[2]=n*r,this._backgroundColor4f[3]=r,this._backgroundColor3b[0]=t*r*255,this._backgroundColor3b[1]=e*r*255,this._backgroundColor3b[2]=n*r*255}setDebugCanvas(t){this._debugCanvas=t}setUseGpuMode(t){this._useGpuMode=t}setStageSize(t,e,n,r){this._xLeft=t,this._xRight=e,this._yBottom=n,this._yTop=r,this._projection=s.m4.ortho(t,e,n,r,-1,1),this._setNativeSize(Math.abs(e-t),Math.abs(n-r))}getNativeSize(){return[this._nativeSize[0],this._nativeSize[1]]}_setNativeSize(t,e){this._nativeSize=[t,e],this._updateOverlays(),this.emit(d.Events.NativeSizeChanged,{newSize:this._nativeSize})}addOverlay(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"scale";const n=document.createElement("div");n.appendChild(t),this.overlayContainer.appendChild(n);const r={container:n,userElement:t,mode:e};return this._overlays.push(r),this._updateOverlays(),r}removeOverlay(t){const e=this._overlays.findIndex((e=>e.userElement===t));-1!==e&&(this._overlays[e].container.remove(),this._overlays.splice(e,1))}_updateOverlays(){const[t,e]=this._nativeSize,n=this.canvas.width/window.devicePixelRatio,r=this.canvas.height/window.devicePixelRatio;this.overlayContainer.style.width="".concat(n,"px"),this.overlayContainer.style.height="".concat(r,"px");for(const i of this._overlays){const s=i.container;if("scale"===i.mode||"scale-centered"===i.mode){const o=n/t,a=r/e;s.style.width="".concat(t,"px"),s.style.height="".concat(e,"px");const c="scale(".concat(o,", ").concat(a,")");if(s.style.transformOrigin="top left","scale"===i.mode)s.style.transform=c;else{const n="translate(".concat(t/2,"px, ").concat(e/2,"px)");s.style.transform="".concat(c," ").concat(n)}}else s.style.transform="",s.style.width="100%",s.style.height="100%"}}createBitmapSkin(t,e,n){const r=this._nextSkinId++,i=new c(r,this);return i.setBitmap(t,e,n),this._allSkins[r]=i,r}createSVGSkin(t,e){const n=this._nextSkinId++,r=new f(n,this);return r.setSVG(t,e),this._allSkins[n]=r,n}createPenSkin(){const t=this._nextSkinId++,e=new h(t,this);return this._allSkins[t]=e,this._penSkinId=t,this._updateRenderQuality(),t}createTextSkin(t,e,n){const r=this._nextSkinId++,i=new m(r,this);return i.setTextBubble(t,e,n),this._allSkins[r]=i,r}updateSVGSkin(t,e,n){if(this._allSkins[t]instanceof f)return void this._allSkins[t].setSVG(e,n);const r=new f(t,this);r.setSVG(e,n),this._reskin(t,r)}updateBitmapSkin(t,e,n,r){if(this._allSkins[t]instanceof c)return void this._allSkins[t].setBitmap(e,n,r);const i=new c(t,this);i.setBitmap(e,n,r),this._reskin(t,i)}_reskin(t,e){const n=this._allSkins[t];this._allSkins[t]=e;for(const t of this._allDrawables)t&&t.skin===n&&(t.skin=e);n.dispose()}updateTextSkin(t,e,n,r){if(this._allSkins[t]instanceof m)return void this._allSkins[t].setTextBubble(e,n,r);const i=new m(t,this);i.setTextBubble(e,n,r),this._reskin(t,i)}destroySkin(t){this._allSkins[t].dispose(),delete this._allSkins[t]}createDrawable(t){if(!t||!Object.prototype.hasOwnProperty.call(this._layerGroups,t))return void y.warn("Cannot create a drawable without a known layer group");const e=this._nextDrawableId++,n=new u(e,this);return this._allDrawables[e]=n,this._addToDrawList(e,t),n.setHighQuality(this.useHighQualityRender),n.skin=null,e}createTextWrapper(t){return new(S||(S=n(273)),S)(t)}markSkinAsPrivate(t){const e=this._allSkins[t];e&&(e.private=!0)}markDrawableAsNoninteractive(t){const e=this._allDrawables[t];e&&(e.interactive=!1)}setLayerGroupOrdering(t){this._groupOrdering=t;for(let t=0;t<this._groupOrdering.length;t++)this._layerGroups[this._groupOrdering[t]]={groupIndex:t,drawListOffset:0}}_addToDrawList(t,e){const n=this._layerGroups[e],r=n.groupIndex,i=this._endIndexForKnownLayerGroup(n);this._drawList.splice(i,0,t),this._updateOffsets("add",r)}_updateOffsets(t,e){for(let n=e+1;n<this._groupOrdering.length;n++){const e=this._groupOrdering[n];"add"===t?this._layerGroups[e].drawListOffset++:"delete"===t&&this._layerGroups[e].drawListOffset--}}get _visibleDrawList(){return this._drawList.filter((t=>this._allDrawables[t]._visible))}_endIndexForKnownLayerGroup(t){const e=t.groupIndex;return e===this._groupOrdering.length-1?this._drawList.length:this._layerGroups[this._groupOrdering[e+1]].drawListOffset}destroyDrawable(t,e){if(!e||!Object.prototype.hasOwnProperty.call(this._layerGroups,e))return void y.warn("Cannot destroy drawable without known layer group.");this.dirty=!0;this._allDrawables[t].dispose(),delete this._allDrawables[t];const n=this._layerGroups[e],r=this._endIndexForKnownLayerGroup(n);let i=n.drawListOffset;for(;i<r&&this._drawList[i]!==t;)i++;i<r?(this._drawList.splice(i,1),this._updateOffsets("delete",n.groupIndex)):y.warn("Could not destroy drawable that could not be found in layer group.")}getDrawableOrder(t){return this._drawList.indexOf(t)}setDrawableOrder(t,e,n,r,i){if(!n||!Object.prototype.hasOwnProperty.call(this._layerGroups,n))return void y.warn("Cannot set the order of a drawable without a known layer group.");this.dirty=!0;const s=this._layerGroups[n],o=s.drawListOffset,a=this._endIndexForKnownLayerGroup(s);let c=o;for(;c<a&&this._drawList[c]!==t;)c++;if(c<a){if(0===e)return c;this._drawList.splice(c,1)[0];let n=e;r&&(n+=c);const s=(i||0)+o,u=s>=o&&s<a?s:o;return n=Math.max(n,u),n=Math.min(n,a),this._drawList.splice(n,0,t),n}return null}skinWasAltered(t){for(let e=0;e<this._drawList.length;e++){const n=this._drawList[e],r=this._allDrawables[n];r._skin===t&&r._skinWasAltered()}}draw(){if(!this.dirty)return;this.dirty=!1,this._doExitDrawRegion();const t=this._gl;s.bindFramebufferInfo(t,null),t.viewport(0,0,t.canvas.width,t.canvas.height),t.clearColor(this._backgroundColor4f[0],this._backgroundColor4f[1],this._backgroundColor4f[2],this._backgroundColor4f[3]),t.clear(t.COLOR_BUFFER_BIT);const e=this._snapshotCallbacks.length>0;if(this._drawThese(this._drawList,p.DRAW_MODE.default,this._projection,{framebufferWidth:t.canvas.width,framebufferHeight:t.canvas.height,skipPrivateSkins:e}),e){const e=t.canvas.toDataURL();this._snapshotCallbacks.forEach((t=>t(e))),this._snapshotCallbacks=[],this.dirty=!0}}getBounds(t){const e=this._allDrawables[t];if(e.needsConvexHullPoints()){const n=this._getConvexHullPointsForDrawable(t);e.setConvexHullPoints(n)}const n=e.getFastBounds();if(this._debugCanvas){const t=this._gl;this._debugCanvas.width=t.canvas.width,this._debugCanvas.height=t.canvas.height;const e=this._debugCanvas.getContext("2d");e.drawImage(t.canvas,0,0),e.strokeStyle="#FF0000";const r=window.devicePixelRatio;e.strokeRect(r*(n.left+this._nativeSize[0]/2),r*(-n.top+this._nativeSize[1]/2),r*(n.right-n.left),r*(-n.bottom+n.top))}return n}getBoundsForBubble(t){const e=this._allDrawables[t];if(e.needsConvexHullPoints()){const n=this._getConvexHullPointsForDrawable(t);e.setConvexHullPoints(n)}const n=e.getBoundsForBubble();if(this._debugCanvas){const t=this._gl;this._debugCanvas.width=t.canvas.width,this._debugCanvas.height=t.canvas.height;const e=this._debugCanvas.getContext("2d");e.drawImage(t.canvas,0,0),e.strokeStyle="#FF0000";const r=window.devicePixelRatio;e.strokeRect(r*(n.left+this._nativeSize[0]/2),r*(-n.top+this._nativeSize[1]/2),r*(n.right-n.left),r*(-n.bottom+n.top))}return n}getCurrentSkinSize(t){const e=this._allDrawables[t];return this.getSkinSize(e.skin.id)}getSkinSize(t){return this._allSkins[t].size}getSkinRotationCenter(t){return this._allSkins[t].calculateRotationCenter()}isTouchingColor(t,e,n){const r=this._candidatesTouching(t,this._visibleDrawList);let i;if(I(e,this._backgroundColor3b,0)){if(i=this._touchingBounds(t),null===i)return!1}else{if(0===r.length)return!1;i=this._candidatesBounds(r)}const s=this._getMaxPixelsForCPU(),o=this._debugCanvas&&this._debugCanvas.getContext("2d");o&&(this._debugCanvas.width=i.width,this._debugCanvas.height=i.height),i.width*i.height*(r.length+1)>=s&&this._isTouchingColorGpuStart(t,r.map((t=>{let{id:e}=t;return e})).reverse(),i,e,n);const a=this._allDrawables[t],c=v,l=E,h=Boolean(n);a.updateCPURenderAttributes();const d=~p.EFFECT_INFO.ghost.mask;for(let t=i.bottom;t<=i.top;t++){if(i.width*(t-i.bottom)*(r.length+1)>=s)return this._isTouchingColorGpuFin(i,e,t-i.bottom);for(let s=i.left;s<=i.right;s++)if(c[1]=t,c[0]=s,(h?(f=u.sampleColor4b(c,a,l,d),m=n,f[3]>0&&(252&f[0])==(252&m[0])&&(252&f[1])==(252&m[1])&&(252&f[2])==(252&m[2])):a.isTouching(c))&&(this.sampleColor4b(c,r,l),o&&(o.fillStyle="rgb(".concat(l[0],",").concat(l[1],",").concat(l[2],")"),o.fillRect(s-i.left,i.bottom-t,1,1)),I(l,e,0)))return!0}var f,m;return!1}_getMaxPixelsForCPU(){switch(this._useGpuMode){case O.UseGpuModes.ForceCPU:return 1/0;case O.UseGpuModes.ForceGPU:return 0;case O.UseGpuModes.Automatic:default:return 4e4}}_enterDrawBackground(){const t=this.gl,e=this._shaderManager.getShader(p.DRAW_MODE.background,0);t.disable(t.BLEND),t.useProgram(e.program),s.setBuffersAndAttributes(t,e,this._bufferInfo)}_exitDrawBackground(){const t=this.gl;t.enable(t.BLEND)}_isTouchingColorGpuStart(t,e,n,r,i){this._doExitDrawRegion();const o=this._gl;s.bindFramebufferInfo(o,this._queryBufferInfo),o.viewport(0,0,n.width,n.height);const a=s.m4.ortho(n.left,n.right,n.top,n.bottom,-1,1);let c;o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT|o.STENCIL_BUFFER_BIT),i&&(c={u_colorMask:[i[0]/255,i[1]/255,i[2]/255],u_colorMaskTolerance:2/255});try{o.enable(o.STENCIL_TEST),o.stencilFunc(o.ALWAYS,1,1),o.stencilOp(o.KEEP,o.KEEP,o.REPLACE),o.colorMask(!1,!1,!1,!1),this._drawThese([t],i?p.DRAW_MODE.colorMask:p.DRAW_MODE.silhouette,a,{extraUniforms:c,ignoreVisibility:!0,effectMask:~p.EFFECT_INFO.ghost.mask}),o.stencilFunc(o.EQUAL,1,1),o.stencilOp(o.KEEP,o.KEEP,o.KEEP),o.colorMask(!0,!0,!0,!0),this.enterDrawRegion(this._backgroundDrawRegionId);const n={u_backgroundColor:this._backgroundColor4f},r=this._shaderManager.getShader(p.DRAW_MODE.background,0);s.setUniforms(r,n),s.drawBufferInfo(o,this._bufferInfo,o.TRIANGLES),this._drawThese(e,p.DRAW_MODE.default,a,{idFilterFunc:e=>e!==t})}finally{o.colorMask(!0,!0,!0,!0),o.disable(o.STENCIL_TEST),this._doExitDrawRegion()}}_isTouchingColorGpuFin(t,e,n){const r=this._gl,i=new Uint8Array(Math.floor(t.width*(t.height-n)*4));if(r.readPixels(0,0,t.width,t.height-n,r.RGBA,r.UNSIGNED_BYTE,i),this._debugCanvas){this._debugCanvas.width=t.width,this._debugCanvas.height=t.height;const e=this._debugCanvas.getContext("2d"),r=e.getImageData(0,0,t.width,t.height-n);r.data.set(i),e.putImageData(r,0,0)}for(let t=0;t<i.length;t+=4)if(0!==i[t+3]&&I(e,i,t))return!0;return!1}isTouchingDrawables(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._drawList;const n=this._candidatesTouching(t,e.filter((t=>this._allDrawables[t]._visible)));if(0===n.length||!this._allDrawables[t]._visible)return!1;const r=this._candidatesBounds(n),i=this._allDrawables[t],s=v;i.updateCPURenderAttributes();for(let t=r.left;t<=r.right;t++){s[0]=t;for(let t=r.bottom;t<=r.top;t++)if(s[1]=t,i.isTouching(s))for(let t=0;t<n.length;t++)if(n[t].drawable.isTouching(s))return!0}return!1}clientSpaceToScratchBounds(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;const i=this._gl,s=this._nativeSize[0]/i.canvas.clientWidth,o=this._nativeSize[1]/i.canvas.clientHeight;n*=s,r*=o,n=Math.max(1,Math.min(Math.round(n),k[0])),r=Math.max(1,Math.min(Math.round(r),k[1]));const a=t*s-(n-1)/2,c=e*o+(r-1)/2,u=n%2?0:-.5,h=r%2?0:-.5,d=new l;return d.initFromBounds(Math.floor(this._xLeft+a+u),Math.floor(this._xLeft+a+u+n-1),Math.ceil(this._yTop-c+h),Math.ceil(this._yTop-c+h+r-1)),d}drawableTouching(t,e,n,r,i){const o=this._allDrawables[t];if(!o)return!1;const a=this.clientSpaceToScratchBounds(e,n,r,i),c=o.getFastBounds();if(c.snapToInt(),!c.intersects(a))return!1;o.updateCPURenderAttributes();const u=s.v3.create();for(u[1]=a.bottom;u[1]<=a.top;u[1]++)for(u[0]=a.left;u[0]<=a.right;u[0]++)if(o.isTouching(u))return!0;return!1}pick(t,e,n,r,i){const o=this.clientSpaceToScratchBounds(t,e,n,r);if(o.left===-1/0||o.bottom===-1/0)return d.ID_NONE;if(0===(i=(i||this._drawList).filter((t=>{const e=this._allDrawables[t];if(!i&&!e.interactive)return!1;if(e.getVisible()&&0!==e.getUniforms().u_ghost){const t=e.getFastBounds();return!!o.intersects(t)&&(e.updateCPURenderAttributes(),!0)}return!1}))).length)return d.ID_NONE;const a=[],c=s.v3.create(0,0,0);for(c[1]=o.bottom;c[1]<=o.top;c[1]++)for(c[0]=o.left;c[0]<=o.right;c[0]++)for(let t=i.length-1;t>=0;t--){const e=i[t];if(this._allDrawables[e].isTouching(c)){a[e]=(a[e]||0)+1;break}}a[d.ID_NONE]=0;let u=d.ID_NONE;for(const t in a)Object.prototype.hasOwnProperty.call(a,t)&&a[t]>a[u]&&(u=t);return Number(u)}extractDrawableScreenSpace(t){const e=this._allDrawables[t];if(!e)throw new Error("Could not extract drawable with ID ".concat(t,"; it does not exist"));this._doExitDrawRegion();const n=.5*this._nativeSize[0],r=.5*this._nativeSize[1],i=e.getFastBounds(),o=this.canvas,a=o.width/this._nativeSize[0],c=new l;c.initFromBounds((i.left+n)*a,(i.right+n)*a,(r-i.top)*a,(r-i.bottom)*a),c.snapToInt(),i.initFromBounds(c.left/a-n,c.right/a-n,r-c.top/a,r-c.bottom/a);const u=this._gl,h=u.getParameter(u.MAX_TEXTURE_SIZE),d=Math.min(2048,c.width,h),f=Math.min(2048,c.height,h),m=s.createFramebufferInfo(u,[{format:u.RGBA}],d,f);try{s.bindFramebufferInfo(u,m),u.viewport(0,0,d,f);const e=s.m4.ortho(i.left,i.right,i.top,i.bottom,-1,1);u.clearColor(0,0,0,0),u.clear(u.COLOR_BUFFER_BIT),this._drawThese([t],p.DRAW_MODE.straightAlpha,e,{effectMask:~p.EFFECT_INFO.ghost.mask,framebufferWidth:o.width,framebufferHeight:o.height});const n=new Uint8Array(Math.floor(d*f*4));u.readPixels(0,0,d,f,u.RGBA,u.UNSIGNED_BYTE,n);const r=new ImageData(new Uint8ClampedArray(n.buffer),d,f),a=o.getBoundingClientRect().width/o.width;return{imageData:r,x:c.left*a,y:c.bottom*a,width:c.width*a,height:c.height*a}}finally{u.deleteFramebuffer(m.framebuffer)}}extractColor(t,e,n){this._doExitDrawRegion();const r=Math.round(this._nativeSize[0]*(t/this._gl.canvas.clientWidth-.5)),i=Math.round(-this._nativeSize[1]*(e/this._gl.canvas.clientHeight-.5)),o=this._gl;s.bindFramebufferInfo(o,this._queryBufferInfo);const a=new l;a.initFromBounds(r-n,r+n,i-n,i+n);const c=r-a.left,u=a.top-i;o.viewport(0,0,a.width,a.height);const h=s.m4.ortho(a.left,a.right,a.top,a.bottom,-1,1);o.clearColor(this._backgroundColor4f[0],this._backgroundColor4f[1],this._backgroundColor4f[2],this._backgroundColor4f[3]),o.clear(o.COLOR_BUFFER_BIT),this._drawThese(this._drawList,p.DRAW_MODE.default,h);const d=new Uint8Array(Math.floor(a.width*a.height*4));o.readPixels(0,0,a.width,a.height,o.RGBA,o.UNSIGNED_BYTE,d);const f=Math.floor(4*(u*a.width+c)),m={r:d[f],g:d[f+1],b:d[f+2],a:d[f+3]};if(this._debugCanvas){this._debugCanvas.width=a.width,this._debugCanvas.height=a.height;const t=this._debugCanvas.getContext("2d"),e=t.createImageData(a.width,a.height);e.data.set(d),t.putImageData(e,0,0),t.strokeStyle="black",t.fillStyle="rgba(".concat(m.r,", ").concat(m.g,", ").concat(m.b,", ").concat(m.a,")"),t.rect(c-4,u-4,8,8),t.fill(),t.stroke()}return{data:d,width:a.width,height:a.height,color:m}}_touchingBounds(t){const e=this._allDrawables[t];if(!e.skin||!e.skin.getTexture([100,100]))return null;const n=e.getFastBounds();return this.offscreenTouching||n.clamp(this._xLeft,this._xRight,this._yBottom,this._yTop),n.snapToInt(),0===n.width||0===n.height?null:n}_unsnappedTouchingBounds(t){const e=this._allDrawables[t];if(!e.skin||!e.skin.getTexture([100,100]))return null;const n=e.getFastBounds();return this.offscreenTouching||n.clamp(this._xLeft,this._xRight,this._yBottom,this._yTop),0===n.width||0===n.height?null:n}_candidatesTouching(t,e){const n=this._touchingBounds(t),r=[];if(null===n)return r;for(let i=e.length-1;i>=0;i--){const s=e[i];if(s!==t){const t=this._allDrawables[s];if(t.skin instanceof m)continue;if(t.skin&&t._visible){if(!this.allowPrivateSkinAccess&&t.skin.private)continue;t.updateCPURenderAttributes();const e=t.getFastBounds();e.snapToInt(),n.intersects(e)&&r.push({id:s,drawable:t,intersection:l.intersect(n,e)})}}}return r}_candidatesBounds(t){return t.reduce(((t,e)=>{let{intersection:n}=e;return t?l.union(t,n,w):n}),null)}updateDrawableSkinId(t,e){const n=this._allDrawables[t];n&&(n.skin=this._allSkins[e])}updateDrawablePosition(t,e){const n=this._allDrawables[t];n&&n.updatePosition(e)}updateDrawableDirection(t,e){const n=this._allDrawables[t];n&&n.updateDirection(e)}updateDrawableScale(t,e){const n=this._allDrawables[t];n&&n.updateScale(e)}updateDrawableDirectionScale(t,e,n){const r=this._allDrawables[t];r&&(r.updateDirection(e),r.updateScale(n))}updateDrawableVisible(t,e){const n=this._allDrawables[t];n&&n.updateVisible(e)}updateDrawableEffect(t,e,n){const r=this._allDrawables[t];r&&r.updateEffect(e,n)}updateDrawableProperties(t,e){const n=this._allDrawables[t];n&&("skinId"in e&&this.updateDrawableSkinId(t,e.skinId),n.updateProperties(e))}getFencedPositionOfDrawable(t,e){let n=e[0],r=e[1];const i=this._allDrawables[t];if(!i)return[n,r];const s=n-i._position[0],o=r-i._position[1],a=i._skin.getFenceBounds(i,T),c=Math.floor(Math.min(a.width,a.height)/2),u=this._xRight-Math.min(15,c);a.right+s<-u?n=Math.ceil(i._position[0]-(u+a.right)):a.left+s>u&&(n=Math.floor(i._position[0]+(u-a.left)));const l=this._yTop-Math.min(15,c);return a.top+o<-l?r=Math.ceil(i._position[1]-(l+a.top)):a.bottom+o>l&&(r=Math.floor(i._position[1]+(l-a.bottom))),[n,r]}penClear(t){this.dirty=!0;this._allSkins[t].clear()}penPoint(t,e,n,r){this.dirty=!0;this._allSkins[t].drawPoint(e,n,r)}penLine(t,e,n,r,i,s){this.dirty=!0;this._allSkins[t].drawLine(e,n,r,i,s)}penStamp(t,e){this.dirty=!0;if(!this._allDrawables[e])return;const n=this._unsnappedTouchingBounds(e);if(!n)return;this._doExitDrawRegion();const r=this._allSkins[t],i=this._gl;s.bindFramebufferInfo(i,r._framebuffer);const o=r.renderQuality;n.left*=o,n.right*=o,n.top*=o,n.bottom*=o,n.snapToInt(),i.viewport(.5*this._nativeSize[0]*o+n.left,.5*this._nativeSize[1]*o-n.top,n.width,n.height);const a=s.m4.ortho(n.left/o,n.right/o,n.top/o,n.bottom/o,-1,1);this._drawThese([e],p.DRAW_MODE.default,a,{ignoreVisibility:!0,framebufferWidth:this._nativeSize[0]*o,framebufferHeight:this._nativeSize[1]*o}),r._silhouetteDirty=!0}_createGeometry(){this._bufferInfo=s.createBufferInfoFromArrays(this._gl,{a_position:{numComponents:2,data:[-.5,-.5,.5,-.5,-.5,.5,-.5,.5,.5,-.5,.5,.5]},a_texCoord:{numComponents:2,data:[1,0,0,0,1,1,1,1,0,0,0,1]}})}onNativeSizeChanged(t){this.dirty=!0;const[e,n]=t.newSize,r=this._gl,i=[{format:r.RGBA},{format:r.DEPTH_STENCIL}];this._pickBufferInfo||(this._pickBufferInfo=s.createFramebufferInfo(r,i,k[0],k[1])),this._queryBufferInfo?s.resizeFramebufferInfo(r,this._queryBufferInfo,i,e,n):this._queryBufferInfo=s.createFramebufferInfo(r,i,e,n)}enterDrawRegion(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.enter,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.exit;this._regionId!==t&&(this._doExitDrawRegion(),this._regionId=t,e(),this._exitRegion=n)}_doExitDrawRegion(){null!==this._exitRegion&&this._exitRegion(),this._exitRegion=null,this._regionId=null}_drawThese(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const i=this._gl;let o=null;const a="framebufferWidth"in r&&"framebufferHeight"in r&&r.framebufferWidth!==this._nativeSize[0]&&r.framebufferHeight!==this._nativeSize[1],c=t.length;for(let u=0;u<c;++u){const c=t[u];if(r.filter&&!r.filter(c))continue;const l=this._allDrawables[c];if(!l.getVisible()&&!r.ignoreVisibility)continue;const h=a?[l.scale[0]*r.framebufferWidth/this._nativeSize[0],l.scale[1]*r.framebufferHeight/this._nativeSize[1]]:l.scale;if(!l.skin||!l.skin.getTexture(h))continue;if(r.skipPrivateSkins&&l.skin.private)continue;const d={};let p=l.enabledEffects;p&=Object.prototype.hasOwnProperty.call(r,"effectMask")?r.effectMask:p;const f=this._shaderManager.getShader(e,p);this._regionId!==f&&(this._doExitDrawRegion(),this._regionId=f,o=f,i.useProgram(o.program),s.setBuffersAndAttributes(i,o,this._bufferInfo),Object.assign(d,{u_projectionMatrix:n})),Object.assign(d,l.skin.getUniforms(h),l.getUniforms()),r.extraUniforms&&Object.assign(d,r.extraUniforms),d.u_skin&&s.setTextureParameters(i,d.u_skin,{minMag:l.skin.useNearest(h,l)?i.NEAREST:i.LINEAR}),s.setUniforms(o,d),s.drawBufferInfo(i,this._bufferInfo,i.TRIANGLES)}this._regionId=null}_getConvexHullPointsForDrawable(t){const e=this._allDrawables[t],[n,r]=e.skin.size;if(!e.getVisible()||0===n||0===r)return[];e.updateCPURenderAttributes();const o=function(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])},a=[],c=[];let u=-1,l=-1;const h=s.v3.create(),d=s.v3.create();let p;for(let t=0;t<r;t++){h[1]=t/r;let i=0;for(;i<n;i++)if(h[0]=i/n,g.transformPoint(e,h,d),e.skin.isTouchingLinear(d)){p=[i,t];break}if(!(i>=n)){for(;u>0&&!(o(a[u],a[u-1],p)>0);)--u;for(a[++u]=p,i=n-1;i>=0;i--)if(h[0]=i/n,g.transformPoint(e,h,d),e.skin.isTouchingLinear(d)){p=[i,t];break}for(;l>0&&!(o(c[l],c[l-1],p)<0);)--l;c[++l]=p}}const f=a;f.length=u+1;for(let t=l;t>=0;--t)f.push(c[t]);return i(f,1/0)}sampleColor4b(t,e,n){(n=n||new Uint8ClampedArray(4))[0]=0,n[1]=0,n[2]=0;let r=1;for(let i=0;0!==r&&i<e.length;i++)u.sampleColor4b(t,e[i].drawable,A),n[0]+=A[0]*r,n[1]+=A[1]*r,n[2]+=A[2]*r,r*=1-A[3]/255;return n[0]+=255*this._backgroundColor4f[0]*r,n[1]+=255*this._backgroundColor4f[1]*r,n[2]+=255*this._backgroundColor4f[2]*r,r*=1-this._backgroundColor4f[3],n[3]=255*(1-r),n}requestSnapshot(t){this.dirty=!0,this._snapshotCallbacks.push(t)}setCustomFonts(t){this.customFonts=t;const e=Object.values(t).join("\n");if(e.length?(this._customFontStyles||(this._customFontStyles=document.createElement("style"),this._customFontStyles.className="renderer-custom-fonts",document.head.appendChild(this._customFontStyles)),this._customFontStyles.textContent=e):this._customFontStyles&&(this._customFontStyles.remove(),this._customFontStyles=null),"object"==typeof document&&"object"==typeof document.fonts&&"function"==typeof document.fonts.load){const e=Object.keys(t);for(const t of e)document.fonts.load("12px ".concat(t))}}}O.prototype.canHazPixels=O.prototype.extractDrawableScreenSpace,O.UseGpuModes={Automatic:"Automatic",ForceGPU:"ForceGPU",ForceCPU:"ForceCPU"},O.powerPreference="default",t.exports=O},function(t,e,n){"use strict";var r=n(260),i=n(261),s=n(262),o=n(263);function a(t,e){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function c(t,e,n){var r=[e[0]-t[0],e[1]-t[1]],i=[n[0]-t[0],n[1]-t[1]],s=a(t,e),o=a(t,n);return(r[0]*i[0]+r[1]*i[1])/Math.sqrt(s*o)}function u(t,e){for(var n=0;n<e.length-1;n++){var i=[e[n],e[n+1]];if(!(t[0][0]===i[0][0]&&t[0][1]===i[0][1]||t[0][0]===i[1][0]&&t[0][1]===i[1][1])&&r(t,i))return!0}return!1}function l(t){return[Math.min(t[0][0],t[1][0]),Math.min(t[0][1],t[1][1]),Math.max(t[0][0],t[1][0]),Math.max(t[0][1],t[1][1])]}function h(t,e,n){for(var r,i,s=null,o=p,a=p,l=0;l<e.length;l++)r=c(t[0],t[1],e[l]),i=c(t[1],t[0],e[l]),r>o&&i>a&&!u([t[0],e[l]],n)&&!u([t[1],e[l]],n)&&(o=r,a=i,s=e[l]);return s}function d(t,e,n,r,i){for(var s,o,c,u,p,f,m,g=!1,b=0;b<t.length-1;b++)if(o=(s=[t[b],t[b+1]])[0].join()+","+s[1].join(),!(a(s[0],s[1])<e||!0===i[o])){c=0,p=l(s);do{f=(p=r.extendBbox(p,c))[2]-p[0],m=p[3]-p[1],u=h(s,r.rangePoints(p),t),c++}while(null===u&&(n[0]>f||n[1]>m));f>=n[0]&&m>=n[1]&&(i[o]=!0),null!==u&&(t.splice(b+1,0,u),r.removePoint(u),g=!0)}return g?d(t,e,n,r,i):t}var p=Math.cos(90/(180/Math.PI)),f=.6;t.exports=function(t,e,n){var r,a,c,u,l,h,p,m=e||20;return t.length<4?t.slice():(p=function(t){return t.filter((function(t,e,n){var r=n[e-1];return 0===e||!(r[0]===t[0]&&r[1]===t[1])}))}(function(t){return t.sort((function(t,e){return t[0]==e[0]?t[1]-e[1]:t[0]-e[0]}))}(s.toXy(t,n))),u=function(t){for(var e=1/0,n=1/0,r=-1/0,i=-1/0,s=t.length-1;s>=0;s--)t[s][0]<e&&(e=t[s][0]),t[s][1]<n&&(n=t[s][1]),t[s][0]>r&&(r=t[s][0]),t[s][1]>i&&(i=t[s][1]);return[r-e,i-n]}(p),l=[u[0]*f,u[1]*f],r=o(p),c=p.filter((function(t){return r.indexOf(t)<0})),h=Math.ceil(1/(p.length/(u[0]*u[1]))),a=d(r,Math.pow(m,2),l,i(c,h),{}),s.fromXy(a,n))}},function(t,e){function n(t,e,n,r,i,s){var o=(s-e)*(n-t)-(r-e)*(i-t);return o>0||!(o<0)}t.exports=function(t,e){var r=t[0][0],i=t[0][1],s=t[1][0],o=t[1][1],a=e[0][0],c=e[0][1],u=e[1][0],l=e[1][1];return n(r,i,a,c,u,l)!==n(s,o,a,c,u,l)&&n(r,i,s,o,a,c)!==n(r,i,s,o,u,l)}},function(t,e){function n(t,e){this._cells=[],this._cellSize=e,t.forEach((function(t){var e=this.point2CellXY(t),n=e[0],r=e[1];void 0===this._cells[n]&&(this._cells[n]=[]),void 0===this._cells[n][r]&&(this._cells[n][r]=[]),this._cells[n][r].push(t)}),this)}n.prototype={cellPoints:function(t,e){return void 0!==this._cells[t]&&void 0!==this._cells[t][e]?this._cells[t][e]:[]},rangePoints:function(t){for(var e=this.point2CellXY([t[0],t[1]]),n=this.point2CellXY([t[2],t[3]]),r=[],i=e[0];i<=n[0];i++)for(var s=e[1];s<=n[1];s++)r=r.concat(this.cellPoints(i,s));return r},removePoint:function(t){for(var e,n=this.point2CellXY(t),r=this._cells[n[0]][n[1]],i=0;i<r.length;i++)if(r[i][0]===t[0]&&r[i][1]===t[1]){e=i;break}return r.splice(e,1),r},point2CellXY:function(t){return[parseInt(t[0]/this._cellSize),parseInt(t[1]/this._cellSize)]},extendBbox:function(t,e){return[t[0]-e*this._cellSize,t[1]-e*this._cellSize,t[2]+e*this._cellSize,t[3]+e*this._cellSize]}},t.exports=function(t,e){return new n(t,e)}},function(t,e){t.exports={toXy:function(t,e){return void 0===e?t.slice():t.map((function(t){return new Function("pt","return [pt"+e[0]+",pt"+e[1]+"];")(t)}))},fromXy:function(t,e){return void 0===e?t.slice():t.map((function(t){return new Function("pt","var o = {}; o"+e[0]+"= pt[0]; o"+e[1]+"= pt[1]; return o;")(t)}))}}},function(t,e){function n(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}t.exports=function(t){var e,r=function(t){for(var e=[],r=0;r<t.length;r++){for(;e.length>=2&&n(e[e.length-2],e[e.length-1],t[r])<=0;)e.pop();e.push(t[r])}return e.pop(),e}(t),i=function(t){for(var e=t.reverse(),r=[],i=0;i<e.length;i++){for(;r.length>=2&&n(r[r.length-2],r[r.length-1],e[i])<=0;)r.pop();r.push(e[i])}return r.pop(),r}(t);return(e=i.concat(r)).push(t[0]),e}},function(t,e){let n;const r=(t,e)=>e^(t^e)&t-e>>31,i=(t,e)=>t^(t^e)&t-e>>31,s=(t,e,n)=>{let{_width:r,_height:i,_colorData:s}=t;return e>=r||n>=i||e<0||n<0?0:s[4*(n*r+e)+3]},o=[new Uint8ClampedArray(4),new Uint8ClampedArray(4),new Uint8ClampedArray(4),new Uint8ClampedArray(4)],a=(t,e,n,s)=>{let{_width:o,_height:a,_colorData:c}=t;if(e=i(0,r(e,o-1)),n=i(0,r(n,a-1)),e>=o||n>=a||e<0||n<0)return s.fill(0);const u=4*(n*o+e),l=c[u+3]/255;return s[0]=c[u]*l,s[1]=c[u+1]*l,s[2]=c[u+2]*l,s[3]=c[u+3],s},c=(t,e,n,s)=>{let{_width:o,_height:a,_colorData:c}=t;e=i(0,r(e,o-1));const u=4*((n=i(0,r(n,a-1)))*o+e);return s[0]=c[u],s[1]=c[u+1],s[2]=c[u+2],s[3]=c[u+3],s};class u{constructor(){this._width=0,this._height=0,this._lazyData=null,this._colorData=null,this._getColor=a,this.colorAtNearest=this.colorAtLinear=(t,e)=>e.fill(0)}update(t){let e,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t instanceof ImageData)e=t,this._width=t.width,this._height=t.height,this._lazyData=null,this._colorData=e.data;else{if(this._width=t.width,this._height=t.height,!this._width||!this._height)return;this._lazyData=t,this._colorData=null}this._getColor=n?c:a,delete this.colorAtNearest,delete this.colorAtLinear}unlazy(){if(!this._lazyData)return;const t=this._lazyData.width,e=this._lazyData.height;if(t&&e){const n=u._updateCanvas();n.width=t,n.height=e;const r=n.getContext("2d");r.clearRect(0,0,t,e),r.drawImage(this._lazyData,0,0,t,e);const i=r.getImageData(0,0,t,e);this._colorData=i.data}this._lazyData=null}colorAtNearest(t,e){return this._getColor(this,Math.floor(t[0]*(this._width-1)),Math.floor(t[1]*(this._height-1)),e)}colorAtLinear(t,e){const n=t[0]*(this._width-1),r=t[1]*(this._height-1),i=n%1,s=r%1,a=1-i,c=1-s,u=Math.floor(n),l=Math.floor(r),h=this._getColor(this,u,l,o[0]),d=this._getColor(this,u+1,l,o[1]),p=this._getColor(this,u,l+1,o[2]),f=this._getColor(this,u+1,l+1,o[3]);return e[0]=h[0]*a*c+p[0]*a*s+d[0]*i*c+f[0]*i*s,e[1]=h[1]*a*c+p[1]*a*s+d[1]*i*c+f[1]*i*s,e[2]=h[2]*a*c+p[2]*a*s+d[2]*i*c+f[2]*i*s,e[3]=h[3]*a*c+p[3]*a*s+d[3]*i*c+f[3]*i*s,e}isTouchingNearest(t){if(this._colorData)return s(this,Math.floor(t[0]*(this._width-1)),Math.floor(t[1]*(this._height-1)))>0}isTouchingLinear(t){if(!this._colorData)return;const e=Math.floor(t[0]*(this._width-1)),n=Math.floor(t[1]*(this._height-1));return s(this,e,n)>0||s(this,e+1,n)>0||s(this,e,n+1)>0||s(this,e+1,n+1)>0}static _updateCanvas(){return void 0===n&&(n=document.createElement("canvas")),n}}t.exports=u},function(t,e,n){const r=n(10),i=n(25);class s extends i{constructor(t,e){super(t,e),this._costumeResolution=1,this._textureSize=[0,0]}dispose(){this._texture&&(this._renderer.gl.deleteTexture(this._texture),this._texture=null),super.dispose()}get size(){return[this._textureSize[0]/this._costumeResolution,this._textureSize[1]/this._costumeResolution]}getTexture(t){return this._texture||super.getTexture()}setBitmap(t,e,n){if(!t.width||!t.height)return void super.setEmptyImageData();const i=this._renderer.gl;let o=t;if(t instanceof HTMLCanvasElement&&!1!==t.reusable){o=t.getContext("2d").getImageData(0,0,t.width,t.height)}if(null===this._texture){const t={auto:!1,wrap:i.CLAMP_TO_EDGE};this._texture=r.createTexture(i,t)}this._setTexture(o),this._costumeResolution=e||2,this._textureSize=s._getBitmapSize(t),void 0===n&&(n=this.calculateRotationCenter()),this._rotationCenter[0]=n[0],this._rotationCenter[1]=n[1],this.emitWasAltered()}static _getBitmapSize(t){return t instanceof HTMLImageElement?[t.naturalWidth||t.width,t.naturalHeight||t.height]:t instanceof HTMLVideoElement?[t.videoWidth||t.width,t.videoHeight||t.height]:[t.width,t.height]}}t.exports=s},function(t,e,n){const r=n(10),i=n(84),s=n(32),o=n(26),a=n(85),c=n(86),u=r.v3.create(),l=1e-6,h=(t,e)=>{const n=u,r=e[0],i=e[1],s=t._inverseMatrix,o=r*s[3]+i*s[7]+s[15];return n[0]=.5-(r*s[0]+i*s[4]+s[12])/o,n[1]=(r*s[1]+i*s[5]+s[13])/o+.5,Math.abs(n[0])<l&&(n[0]=0),Math.abs(n[1])<l&&(n[1]=0),0!==t.enabledEffects&&n[0]>=0&&n[0]<1&&n[1]>=0&&n[1]<1&&a.transformPoint(t,n,n),n};class d{constructor(t,e){this._id=t,this._renderer=e,this._uniforms={u_modelMatrix:r.m4.identity(),u_silhouetteColor:d.color4fFromID(this._id)};const n=o.EFFECTS.length;for(let t=0;t<n;++t){const e=o.EFFECTS[t],n=o.EFFECT_INFO[e],r=n.converter;this._uniforms[n.uniformName]=r(0)}this._position=r.v3.create(0,0),this._scale=r.v3.create(100,100),this._direction=90,this._transformDirty=!0,this._rotationMatrix=r.m4.identity(),this._rotationTransformDirty=!0,this._rotationAdjusted=r.v3.create(),this._rotationCenterDirty=!0,this._skinScale=r.v3.create(0,0,0),this._skinScaleDirty=!0,this._inverseMatrix=r.m4.identity(),this._inverseTransformDirty=!0,this._visible=!0,this.enabledEffects=0,this._convexHullPoints=null,this._convexHullDirty=!0,this._transformedHullPoints=null,this._transformedHullDirty=!0,this._skinWasAltered=this._skinWasAltered.bind(this),this.isTouching=this._isTouchingNever,this._highQuality=!1,this.interactive=!0}setHighQuality(t){this._highQuality=t}dispose(){this.skin=null}setTransformDirty(){this._transformDirty=!0,this._inverseTransformDirty=!0,this._transformedHullDirty=!0}get id(){return this._id}get skin(){return this._skin}set skin(t){this._skin!==t&&(this._skin=t,this._skinWasAltered())}get scale(){return[this._scale[0],this._scale[1]]}getUniforms(){return this._transformDirty&&this._calculateTransform(),this._uniforms}getVisible(){return this._visible}updatePosition(t){this._position[0]===t[0]&&this._position[1]===t[1]||(this._highQuality?(this._position[0]=t[0],this._position[1]=t[1]):(this._position[0]=Math.round(t[0]),this._position[1]=Math.round(t[1])),this._renderer.dirty=!0,this.setTransformDirty())}updateDirection(t){this._direction!==t&&(this._direction=t,this._renderer.dirty=!0,this._rotationTransformDirty=!0,this.setTransformDirty())}updateScale(t){this._scale[0]===t[0]&&this._scale[1]===t[1]||(this._scale[0]=t[0],this._scale[1]=t[1],this._renderer.dirty=!0,this._rotationCenterDirty=!0,this._skinScaleDirty=!0,this.setTransformDirty())}updateVisible(t){this._visible!==t&&(this._visible=t,this._renderer.dirty=!0,this.setConvexHullDirty())}updateEffect(t,e){this._renderer.dirty=!0;const n=o.EFFECT_INFO[t];e?this.enabledEffects|=n.mask:this.enabledEffects&=~n.mask;const r=n.converter;this._uniforms[n.uniformName]=r(e),n.shapeChanges&&this.setConvexHullDirty()}updateProperties(t){"position"in t&&this.updatePosition(t.position),"direction"in t&&this.updateDirection(t.direction),"scale"in t&&this.updateScale(t.scale),"visible"in t&&this.updateVisible(t.visible);const e=o.EFFECTS.length;for(let n=0;n<e;++n){const e=o.EFFECTS[n];e in t&&this.updateEffect(e,t[e])}}_calculateTransform(){if(this._rotationTransformDirty){const t=(270-this._direction)*Math.PI/180,e=Math.cos(t),n=Math.sin(t);this._rotationMatrix[0]=e,this._rotationMatrix[1]=n,this._rotationMatrix[4]=-n,this._rotationMatrix[5]=e,this._rotationTransformDirty=!1}if(this._rotationCenterDirty&&null!==this.skin){const t=this.skin.rotationCenter,e=this.skin.size,n=t[0],r=t[1],i=e[0],s=e[1],o=this._scale[0],a=this._scale[1],c=this._rotationAdjusted;c[0]=(n-i/2)*o/100,c[1]=(r-s/2)*a/100*-1,this._rotationCenterDirty=!1}if(this._skinScaleDirty&&null!==this.skin){const t=this.skin.size,e=this._skinScale;e[0]=t[0]*this._scale[0]/100,e[1]=t[1]*this._scale[1]/100,this._skinScaleDirty=!1}const t=this._uniforms.u_modelMatrix,e=this._skinScale[0],n=this._skinScale[1],r=this._rotationMatrix[0],i=this._rotationMatrix[1],s=this._rotationMatrix[4],o=this._rotationMatrix[5],a=this._rotationAdjusted[0],c=this._rotationAdjusted[1],u=this._position[0],l=this._position[1];t[0]=e*r,t[1]=e*i,t[4]=n*s,t[5]=n*o,t[12]=r*a+s*c+u,t[13]=i*a+o*c+l,this._transformDirty=!1}needsConvexHullPoints(){return!this._convexHullPoints||this._convexHullDirty||0===this._convexHullPoints.length}setConvexHullDirty(){this._convexHullDirty=!0}setConvexHullPoints(t){this._convexHullPoints=t,this._convexHullDirty=!1,this._transformedHullPoints=[];for(let e=0;e<t.length;e++)this._transformedHullPoints.push(r.v3.create());this._transformedHullDirty=!0}_isTouchingNever(t){return!1}_isTouchingNearest(t){return this.skin.isTouchingNearest(h(this,t))}_isTouchingLinear(t){return this.skin.isTouchingLinear(h(this,t))}getBounds(t){if(this.needsConvexHullPoints())throw new Error("Needs updated convex hull points before bounds calculation.");this._transformDirty&&this._calculateTransform();const e=this._getTransformedHullPoints();return(t=t||new i).initFromPointsAABB(e),t}getBoundsForBubble(t){if(this.needsConvexHullPoints())throw new Error("Needs updated convex hull points before bubble bounds calculation.");this._transformDirty&&this._calculateTransform();const e=this._getTransformedHullPoints(),n=Math.max.apply(null,e.map((t=>t[1]))),r=e.filter((t=>t[1]>n-8));return(t=t||new i).initFromPointsAABB(r),t}getAABB(t){this._transformDirty&&this._calculateTransform();const e=this._uniforms.u_modelMatrix;return(t=t||new i).initFromModelMatrix(e),t}getFastBounds(t){return this.needsConvexHullPoints()?this.getAABB(t):this.getBounds(t)}_getTransformedHullPoints(){if(!this._transformedHullDirty)return this._transformedHullPoints;const t=r.m4.ortho(-1,1,-1,1,-1,1),e=this.skin.size,n=1/e[0]/2,i=1/e[1]/2,s=r.m4.multiply(this._uniforms.u_modelMatrix,t);for(let t=0;t<this._convexHullPoints.length;t++){const o=this._convexHullPoints[t],a=this._transformedHullPoints[t];a[0]=.5+-o[0]/e[0]-n,a[1]=o[1]/e[1]-.5+i,r.m4.transformPoint(s,a,a)}return this._transformedHullDirty=!1,this._transformedHullPoints}updateMatrix(){if(this._transformDirty&&this._calculateTransform(),this._inverseTransformDirty){const t=this._inverseMatrix;r.m4.copy(this._uniforms.u_modelMatrix,t),t[10]=1,r.m4.inverse(t,t),this._inverseTransformDirty=!1}}updateCPURenderAttributes(){this.updateMatrix(),this.skin?(this.skin.updateSilhouette(this._scale),this.skin.useNearest(this._scale,this)?this.isTouching=this._isTouchingNearest:this.isTouching=this._isTouchingLinear):(c.warn("Could not find skin for drawable with id: ".concat(this._id)),this.isTouching=this._isTouchingNever)}_skinWasAltered(){this._renderer.dirty=!0,this._rotationCenterDirty=!0,this._skinScaleDirty=!0,this.setConvexHullDirty(),this.setTransformDirty()}static color4fFromID(t){return[(255&(t-=s.ID_NONE))/255,(t>>8&255)/255,(t>>16&255)/255,1]}static color3bToID(t,e,n){let r;return r=255&t,r|=(255&e)<<8,r|=(255&n)<<16,r+s.ID_NONE}static sampleColor4b(t,e,n,r){const i=h(e,t);if(i[0]<0||i[1]<0||i[0]>1||i[1]>1)return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n;const s=e.skin._silhouette.colorAtNearest(i,n);return 0===e.enabledEffects?s:a.transformColor(e,s,r)}}t.exports=d},function(t,e){t.exports="precision mediump float;\n\n#ifdef DRAW_MODE_line\nuniform vec2 u_stageSize;\nattribute vec2 a_lineThicknessAndLength;\nattribute vec4 a_penPoints;\nattribute vec4 a_lineColor;\n\nvarying vec4 v_lineColor;\nvarying float v_lineThickness;\nvarying float v_lineLength;\nvarying vec4 v_penPoints;\n\n// Add this to divisors to prevent division by 0, which results in NaNs propagating through calculations.\n// Smaller values can cause problems on some mobile devices.\nconst float epsilon = 1e-3;\n#endif\n\n#if !(defined(DRAW_MODE_line) || defined(DRAW_MODE_background))\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_modelMatrix;\nattribute vec2 a_texCoord;\n#endif\n\nattribute vec2 a_position;\n\nvarying vec2 v_texCoord;\n\nvoid main() {\n\t#ifdef DRAW_MODE_line\n\t// Calculate a rotated (\"tight\") bounding box around the two pen points.\n\t// Yes, we're doing this 6 times (once per vertex), but on actual GPU hardware,\n\t// it's still faster than doing it in JS combined with the cost of uniformMatrix4fv.\n\n\t// Expand line bounds by sqrt(2) / 2 each side-- this ensures that all antialiased pixels\n\t// fall within the quad, even at a 45-degree diagonal\n\tvec2 position = a_position;\n\tfloat expandedRadius = (a_lineThicknessAndLength.x * 0.5) + 1.4142135623730951;\n\n\t// The X coordinate increases along the length of the line. It's 0 at the center of the origin point\n\t// and is in pixel-space (so at n pixels along the line, its value is n).\n\tv_texCoord.x = mix(0.0, a_lineThicknessAndLength.y + (expandedRadius * 2.0), a_position.x) - expandedRadius;\n\t// The Y coordinate is perpendicular to the line. It's also in pixel-space.\n\tv_texCoord.y = ((a_position.y - 0.5) * expandedRadius) + 0.5;\n\n\tposition.x *= a_lineThicknessAndLength.y + (2.0 * expandedRadius);\n\tposition.y *= 2.0 * expandedRadius;\n\n\t// 1. Center around first pen point\n\tposition -= expandedRadius;\n\n\t// 2. Rotate quad to line angle\n\tvec2 pointDiff = a_penPoints.zw;\n\t// Ensure line has a nonzero length so it's rendered properly\n\t// As long as either component is nonzero, the line length will be nonzero\n\t// If the line is zero-length, give it a bit of horizontal length\n\tpointDiff.x = (abs(pointDiff.x) < epsilon && abs(pointDiff.y) < epsilon) ? epsilon : pointDiff.x;\n\t// The `normalized` vector holds rotational values equivalent to sine/cosine\n\t// We're applying the standard rotation matrix formula to the position to rotate the quad to the line angle\n\t// pointDiff can hold large values so we must divide by u_lineLength instead of calling GLSL's normalize function:\n\t// https://asawicki.info/news_1596_watch_out_for_reduced_precision_normalizelength_in_opengl_es\n\tvec2 normalized = pointDiff / max(a_lineThicknessAndLength.y, epsilon);\n\tposition = mat2(normalized.x, normalized.y, -normalized.y, normalized.x) * position;\n\n\t// 3. Translate quad\n\tposition += a_penPoints.xy;\n\n\t// 4. Apply view transform\n\tposition *= 2.0 / u_stageSize;\n\tgl_Position = vec4(position, 0, 1);\n\n\tv_lineColor = a_lineColor;\n\tv_lineThickness = a_lineThicknessAndLength.x;\n\tv_lineLength = a_lineThicknessAndLength.y;\n\tv_penPoints = a_penPoints;\n\t#elif defined(DRAW_MODE_background)\n\tgl_Position = vec4(a_position * 2.0, 0, 1);\n\t#else\n\tgl_Position = u_projectionMatrix * u_modelMatrix * vec4(a_position, 0, 1);\n\tv_texCoord = a_texCoord;\n\t#endif\n}\n"},function(t,e){t.exports='precision mediump float;\n\n#ifdef DRAW_MODE_silhouette\nuniform vec4 u_silhouetteColor;\n#else // DRAW_MODE_silhouette\n# ifdef ENABLE_color\nuniform float u_color;\n# endif // ENABLE_color\n# ifdef ENABLE_brightness\nuniform float u_brightness;\n# endif // ENABLE_brightness\n#endif // DRAW_MODE_silhouette\n\n#ifdef DRAW_MODE_colorMask\nuniform vec3 u_colorMask;\nuniform float u_colorMaskTolerance;\n#endif // DRAW_MODE_colorMask\n\n#ifdef ENABLE_fisheye\nuniform float u_fisheye;\n#endif // ENABLE_fisheye\n#ifdef ENABLE_whirl\nuniform float u_whirl;\n#endif // ENABLE_whirl\n#ifdef ENABLE_pixelate\nuniform float u_pixelate;\nuniform vec2 u_skinSize;\n#endif // ENABLE_pixelate\n#ifdef ENABLE_mosaic\nuniform float u_mosaic;\n#endif // ENABLE_mosaic\n#ifdef ENABLE_ghost\nuniform float u_ghost;\n#endif // ENABLE_ghost\n\n#ifdef DRAW_MODE_line\nvarying vec4 v_lineColor;\nvarying float v_lineThickness;\nvarying float v_lineLength;\n#endif // DRAW_MODE_line\n\n#ifdef DRAW_MODE_background\nuniform vec4 u_backgroundColor;\n#endif // DRAW_MODE_background\n\nuniform sampler2D u_skin;\n\n#ifndef DRAW_MODE_background\nvarying vec2 v_texCoord;\n#endif\n\n// Add this to divisors to prevent division by 0, which results in NaNs propagating through calculations.\n// Smaller values can cause problems on some mobile devices.\nconst float epsilon = 1e-3;\n\n#if !defined(DRAW_MODE_silhouette) && (defined(ENABLE_color))\n// Branchless color conversions based on code from:\n// http://www.chilliant.com/rgb2hsv.html by Ian Taylor\n// Based in part on work by Sam Hocevar and Emil Persson\n// See also: https://en.wikipedia.org/wiki/HSL_and_HSV#Formal_derivation\n\n\n// Convert an RGB color to Hue, Saturation, and Value.\n// All components of input and output are expected to be in the [0,1] range.\nvec3 convertRGB2HSV(vec3 rgb)\n{\n\t// Hue calculation has 3 cases, depending on which RGB component is largest, and one of those cases involves a "mod"\n\t// operation. In order to avoid that "mod" we split the M==R case in two: one for G<B and one for B>G. The B>G case\n\t// will be calculated in the negative and fed through abs() in the hue calculation at the end.\n\t// See also: https://en.wikipedia.org/wiki/HSL_and_HSV#Hue_and_chroma\n\tconst vec4 hueOffsets = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n\n\t// temp1.xy = sort B & G (largest first)\n\t// temp1.z = the hue offset we\'ll use if it turns out that R is the largest component (M==R)\n\t// temp1.w = the hue offset we\'ll use if it turns out that R is not the largest component (M==G or M==B)\n\tvec4 temp1 = rgb.b > rgb.g ? vec4(rgb.bg, hueOffsets.wz) : vec4(rgb.gb, hueOffsets.xy);\n\n\t// temp2.x = the largest component of RGB ("M" / "Max")\n\t// temp2.yw = the smaller components of RGB, ordered for the hue calculation (not necessarily sorted by magnitude!)\n\t// temp2.z = the hue offset we\'ll use in the hue calculation\n\tvec4 temp2 = rgb.r > temp1.x ? vec4(rgb.r, temp1.yzx) : vec4(temp1.xyw, rgb.r);\n\n\t// m = the smallest component of RGB ("min")\n\tfloat m = min(temp2.y, temp2.w);\n\n\t// Chroma = M - m\n\tfloat C = temp2.x - m;\n\n\t// Value = M\n\tfloat V = temp2.x;\n\n\treturn vec3(\n\t\tabs(temp2.z + (temp2.w - temp2.y) / (6.0 * C + epsilon)), // Hue\n\t\tC / (temp2.x + epsilon), // Saturation\n\t\tV); // Value\n}\n\nvec3 convertHue2RGB(float hue)\n{\n\tfloat r = abs(hue * 6.0 - 3.0) - 1.0;\n\tfloat g = 2.0 - abs(hue * 6.0 - 2.0);\n\tfloat b = 2.0 - abs(hue * 6.0 - 4.0);\n\treturn clamp(vec3(r, g, b), 0.0, 1.0);\n}\n\nvec3 convertHSV2RGB(vec3 hsv)\n{\n\tvec3 rgb = convertHue2RGB(hsv.x);\n\tfloat c = hsv.z * hsv.y;\n\treturn rgb * c + hsv.z - c;\n}\n#endif // !defined(DRAW_MODE_silhouette) && (defined(ENABLE_color))\n\nconst vec2 kCenter = vec2(0.5, 0.5);\n\nvoid main()\n{\n\t#if !(defined(DRAW_MODE_line) || defined(DRAW_MODE_background))\n\tvec2 texcoord0 = v_texCoord;\n\n\t#ifdef ENABLE_mosaic\n\ttexcoord0 = fract(u_mosaic * texcoord0);\n\t#endif // ENABLE_mosaic\n\n\t#ifdef ENABLE_pixelate\n\t{\n\t\t// TODO: clean up "pixel" edges\n\t\tvec2 pixelTexelSize = u_skinSize / u_pixelate;\n\t\ttexcoord0 = (floor(texcoord0 * pixelTexelSize) + kCenter) / pixelTexelSize;\n\t}\n\t#endif // ENABLE_pixelate\n\n\t#ifdef ENABLE_whirl\n\t{\n\t\tconst float kRadius = 0.5;\n\t\tvec2 offset = texcoord0 - kCenter;\n\t\tfloat offsetMagnitude = length(offset);\n\t\tfloat whirlFactor = max(1.0 - (offsetMagnitude / kRadius), 0.0);\n\t\tfloat whirlActual = u_whirl * whirlFactor * whirlFactor;\n\t\tfloat sinWhirl = sin(whirlActual);\n\t\tfloat cosWhirl = cos(whirlActual);\n\t\tmat2 rotationMatrix = mat2(\n\t\t\tcosWhirl, -sinWhirl,\n\t\t\tsinWhirl, cosWhirl\n\t\t);\n\n\t\ttexcoord0 = rotationMatrix * offset + kCenter;\n\t}\n\t#endif // ENABLE_whirl\n\n\t#ifdef ENABLE_fisheye\n\t{\n\t\tvec2 vec = (texcoord0 - kCenter) / kCenter;\n\t\tfloat vecLength = length(vec);\n\t\tfloat r = pow(min(vecLength, 1.0), u_fisheye) * max(1.0, vecLength);\n\t\tvec2 unit = vec / vecLength;\n\n\t\ttexcoord0 = kCenter + r * unit * kCenter;\n\t}\n\t#endif // ENABLE_fisheye\n\n\tgl_FragColor = texture2D(u_skin, texcoord0);\n\n\t#if defined(ENABLE_color) || defined(ENABLE_brightness)\n\t// Divide premultiplied alpha values for proper color processing\n\t// Add epsilon to avoid dividing by 0 for fully transparent pixels\n\tgl_FragColor.rgb = clamp(gl_FragColor.rgb / (gl_FragColor.a + epsilon), 0.0, 1.0);\n\n\t#ifdef ENABLE_color\n\t{\n\t\tvec3 hsv = convertRGB2HSV(gl_FragColor.xyz);\n\n\t\t// this code forces grayscale values to be slightly saturated\n\t\t// so that some slight change of hue will be visible\n\t\tconst float minLightness = 0.11 / 2.0;\n\t\tconst float minSaturation = 0.09;\n\t\tif (hsv.z < minLightness) hsv = vec3(0.0, 1.0, minLightness);\n\t\telse if (hsv.y < minSaturation) hsv = vec3(0.0, minSaturation, hsv.z);\n\n\t\thsv.x = mod(hsv.x + u_color, 1.0);\n\t\tif (hsv.x < 0.0) hsv.x += 1.0;\n\n\t\tgl_FragColor.rgb = convertHSV2RGB(hsv);\n\t}\n\t#endif // ENABLE_color\n\n\t#ifdef ENABLE_brightness\n\tgl_FragColor.rgb = clamp(gl_FragColor.rgb + vec3(u_brightness), vec3(0), vec3(1));\n\t#endif // ENABLE_brightness\n\n\t// Re-multiply color values\n\tgl_FragColor.rgb *= gl_FragColor.a + epsilon;\n\n\t#endif // defined(ENABLE_color) || defined(ENABLE_brightness)\n\n\t#ifdef ENABLE_ghost\n\tgl_FragColor *= u_ghost;\n\t#endif // ENABLE_ghost\n\n\t#ifdef DRAW_MODE_silhouette\n\t// Discard fully transparent pixels for stencil test\n\tif (gl_FragColor.a == 0.0) {\n\t\tdiscard;\n\t}\n\t// switch to u_silhouetteColor only AFTER the alpha test\n\tgl_FragColor = u_silhouetteColor;\n\t#else // DRAW_MODE_silhouette\n\n\t#ifdef DRAW_MODE_colorMask\n\tvec3 maskDistance = abs(gl_FragColor.rgb - u_colorMask);\n\tvec3 colorMaskTolerance = vec3(u_colorMaskTolerance, u_colorMaskTolerance, u_colorMaskTolerance);\n\tif (any(greaterThan(maskDistance, colorMaskTolerance)))\n\t{\n\t\tdiscard;\n\t}\n\t#endif // DRAW_MODE_colorMask\n\t#endif // DRAW_MODE_silhouette\n\n\t#ifdef DRAW_MODE_straightAlpha\n\t// Un-premultiply alpha.\n\tgl_FragColor.rgb /= gl_FragColor.a + epsilon;\n\t#endif\n\n\t#endif // !(defined(DRAW_MODE_line) || defined(DRAW_MODE_background))\n\n\t#ifdef DRAW_MODE_line\n\t// Maaaaagic antialiased-line-with-round-caps shader.\n\n\t// "along-the-lineness". This increases parallel to the line.\n\t// It goes from negative before the start point, to 0.5 through the start to the end, then ramps up again\n\t// past the end point.\n\tfloat d = ((v_texCoord.x - clamp(v_texCoord.x, 0.0, v_lineLength)) * 0.5) + 0.5;\n\n\t// Distance from (0.5, 0.5) to (d, the perpendicular coordinate). When we\'re in the middle of the line,\n\t// d will be 0.5, so the distance will be 0 at points close to the line and will grow at points further from it.\n\t// For the "caps", d will ramp down/up, giving us rounding.\n\t// See https://www.youtube.com/watch?v=PMltMdi1Wzg for a rough outline of the technique used to round the lines.\n\tfloat line = distance(vec2(0.5), vec2(d, v_texCoord.y)) * 2.0;\n\t// Expand out the line by its thickness.\n\tline -= ((v_lineThickness - 1.0) * 0.5);\n\t// Because "distance to the center of the line" decreases the closer we get to the line, but we want more opacity\n\t// the closer we are to the line, invert it.\n\tgl_FragColor = v_lineColor * clamp(1.0 - line, 0.0, 1.0);\n\t#endif // DRAW_MODE_line\n\n\t#ifdef DRAW_MODE_background\n\tgl_FragColor = u_backgroundColor;\n\t#endif\n}\n'},function(t,e){t.exports={rgbToHsv:(t,e)=>{let[n,r,i]=t,s=0;n/=255,r/=255,i/=255;let o=0;r<i&&(o=r,r=i,i=o,s=-1),n<r&&(o=n,n=r,r=o,s=-2/6-s);const a=n-Math.min(r,i),c=Math.abs(s+(r-i)/(6*a+Number.EPSILON)),u=a/(n+Number.EPSILON),l=n;return e[0]=c,e[1]=u,e[2]=l,e},hsvToRgb:(t,e)=>{let[n,r,i]=t;if(0===r)return e[0]=e[1]=e[2]=255*i+.5,e;n%=1;const s=6*n|0,o=6*n-s,a=i*(1-r),c=i*(1-r*o),u=i*(1-r*(1-o));let l=0,h=0,d=0;switch(s){case 0:l=i,h=u,d=a;break;case 1:l=c,h=i,d=a;break;case 2:l=a,h=i,d=u;break;case 3:l=a,h=c,d=i;break;case 4:l=u,h=a,d=i;break;case 5:l=i,h=a,d=c}return e[0]=255*l+.5,e[1]=255*h+.5,e[2]=255*d+.5,e}}},function(t,e,n){const r=n(10),i=n(32),s=n(25),o=n(26),a={color4f:[0,0,1,1],diameter:1},c=163800;t.exports=class extends s{constructor(t,e){super(t,e),this._size=null,this._framebuffer=null,this._silhouetteDirty=!1,this._silhouettePixels=null,this._silhouetteImageData=null,this._lineOnBufferDrawRegionId={enter:()=>this._enterDrawLineOnBuffer(),exit:()=>this._exitDrawLineOnBuffer()},this._usePenBufferDrawRegionId={enter:()=>this._enterUsePenBuffer(),exit:()=>this._exitUsePenBuffer()};const n=this._renderer.gl;this.renderQuality=1,this._nativeSize=e.getNativeSize();if(this._lineShader=this._renderer._shaderManager.getShader(o.DRAW_MODE.line,0),this._drawTextureShader=this._renderer._shaderManager.getShader(o.DRAW_MODE.default,0),this._drawTextureRegionId={enter:()=>this._enterDrawTexture(),exit:()=>this._exitDrawTexture()},this.a_position_glbuffer=n.createBuffer(),this.a_position_loc=n.getAttribLocation(this._lineShader.program,"a_position"),this.a_lineColor_loc=n.getAttribLocation(this._lineShader.program,"a_lineColor"),this.a_lineThicknessAndLength_loc=n.getAttribLocation(this._lineShader.program,"a_lineThicknessAndLength"),this.a_penPoints_loc=n.getAttribLocation(this._lineShader.program,"a_penPoints"),this.attribute_glbuffer=n.createBuffer(),this.attribute_index=0,this.attribute_data=new Float32Array(c),n.bindBuffer(n.ARRAY_BUFFER,this.attribute_glbuffer),n.bufferData(n.ARRAY_BUFFER,4*this.attribute_data.length,n.STREAM_DRAW),n.drawArraysInstanced)this.instancedRendering=!0,this.glDrawArraysInstanced=n.drawArraysInstanced.bind(n),this.glVertexAttribDivisor=n.vertexAttribDivisor.bind(n);else{const t=n.getExtension("ANGLE_instanced_arrays");t?(this.instancedRendering=!0,this.glDrawArraysInstanced=t.drawArraysInstancedANGLE.bind(t),this.glVertexAttribDivisor=t.vertexAttribDivisorANGLE.bind(t)):this.instancedRendering=!1}if(this.instancedRendering)n.bindBuffer(n.ARRAY_BUFFER,this.a_position_glbuffer),n.bufferData(n.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),n.STATIC_DRAW);else{const t=new Float32Array(32760);for(let e=0;e<t.length;e+=12)t[e+0]=1,t[e+1]=0,t[e+2]=0,t[e+3]=0,t[e+4]=1,t[e+5]=1,t[e+6]=1,t[e+7]=1,t[e+8]=0,t[e+9]=0,t[e+10]=0,t[e+11]=1;n.bindBuffer(n.ARRAY_BUFFER,this.a_position_glbuffer),n.bufferData(n.ARRAY_BUFFER,t,n.STATIC_DRAW)}this.onNativeSizeChanged=this.onNativeSizeChanged.bind(this),this._renderer.on(i.Events.NativeSizeChanged,this.onNativeSizeChanged),this._setCanvasSize(e.getNativeSize())}dispose(){this._renderer.removeListener(i.Events.NativeSizeChanged,this.onNativeSizeChanged),this._renderer.gl.deleteTexture(this._texture),this._texture=null,super.dispose()}get size(){return this._nativeSize}useNearest(t){return Math.max(t[0],t[1])>=100}getTexture(t){return this._texture}clear(){this._renderer.enterDrawRegion(this._usePenBufferDrawRegionId);const t=this._renderer.gl;t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),this._silhouetteDirty=!0}drawPoint(t,e,n){this.drawLine(t,e,n,e,n)}drawLine(t,e,n,r,i){const s=t.diameter||a.diameter,o=1===s||3===s?.5:0;this._drawLineOnBuffer(t,e+o,n+o,r+o,i+o),this._silhouetteDirty=!0}_enterDrawLineOnBuffer(){const t=this._renderer.gl;r.bindFramebufferInfo(t,this._framebuffer),t.viewport(0,0,this._size[0],this._size[1]);const e=this._lineShader;t.useProgram(e.program);const n={u_skin:this._texture,u_stageSize:this._size};r.setUniforms(e,n),t.bindBuffer(t.ARRAY_BUFFER,this.a_position_glbuffer),t.enableVertexAttribArray(this.a_position_loc),t.vertexAttribPointer(this.a_position_loc,2,t.FLOAT,!1,8,0),this.attribute_index=0}_exitDrawLineOnBuffer(){this.attribute_index&&this._flushLines();const t=this._renderer.gl;r.bindFramebufferInfo(t,null)}_enterUsePenBuffer(){r.bindFramebufferInfo(this._renderer.gl,this._framebuffer)}_exitUsePenBuffer(){r.bindFramebufferInfo(this._renderer.gl,null)}_enterDrawTexture(){this._enterUsePenBuffer();const t=this._renderer.gl;t.viewport(0,0,this._size[0],this._size[1]),t.useProgram(this._drawTextureShader.program),r.setBuffersAndAttributes(t,this._drawTextureShader,this._renderer._bufferInfo)}_exitDrawTexture(){this._exitUsePenBuffer()}_drawPenTexture(t){this._renderer.enterDrawRegion(this._drawTextureRegionId);const e=this._renderer.gl,n=this._size[0],i=this._size[1],s={u_skin:t,u_projectionMatrix:r.m4.ortho(n/2,n/-2,i/-2,i/2,-1,1,r.m4.identity()),u_modelMatrix:r.m4.scaling(r.v3.create(n,i,0),r.m4.identity())};r.setTextureParameters(e,t,{minMag:e.NEAREST}),r.setUniforms(this._drawTextureShader,s),r.drawBufferInfo(e,this._renderer._bufferInfo,e.TRIANGLES)}_drawLineOnBuffer(t,e,n,r,i){this._renderer.enterDrawRegion(this._lineOnBufferDrawRegionId);const s=this.instancedRendering?1:6;this.attribute_index+10*s>c&&this._flushLines();const o=t.color4f||a.color4f;e*=this.renderQuality,n*=this.renderQuality;const u=(r*=this.renderQuality)-e,l=(i*=this.renderQuality)-n,h=Math.sqrt(u*u+l*l),d=(t.diameter||a.diameter)*this.renderQuality;for(let t=0;t<s;t++)this.attribute_data[this.attribute_index]=o[0]*o[3],this.attribute_index++,this.attribute_data[this.attribute_index]=o[1]*o[3],this.attribute_index++,this.attribute_data[this.attribute_index]=o[2]*o[3],this.attribute_index++,this.attribute_data[this.attribute_index]=o[3],this.attribute_index++,this.attribute_data[this.attribute_index]=d,this.attribute_index++,this.attribute_data[this.attribute_index]=h,this.attribute_index++,this.attribute_data[this.attribute_index]=e,this.attribute_index++,this.attribute_data[this.attribute_index]=-n,this.attribute_index++,this.attribute_data[this.attribute_index]=u,this.attribute_index++,this.attribute_data[this.attribute_index]=-l,this.attribute_index++}_flushLines(){const t=this._renderer.gl;t.bindBuffer(t.ARRAY_BUFFER,this.attribute_glbuffer),t.bufferSubData(t.ARRAY_BUFFER,0,new Float32Array(this.attribute_data.buffer,0,this.attribute_index)),t.enableVertexAttribArray(this.a_lineColor_loc),t.vertexAttribPointer(this.a_lineColor_loc,4,t.FLOAT,!1,40,0),t.enableVertexAttribArray(this.a_lineThicknessAndLength_loc),t.vertexAttribPointer(this.a_lineThicknessAndLength_loc,2,t.FLOAT,!1,40,16),t.enableVertexAttribArray(this.a_penPoints_loc),t.vertexAttribPointer(this.a_penPoints_loc,4,t.FLOAT,!1,40,24),this.instancedRendering?(this.glVertexAttribDivisor(this.a_lineColor_loc,1),this.glVertexAttribDivisor(this.a_lineThicknessAndLength_loc,1),this.glVertexAttribDivisor(this.a_penPoints_loc,1),this.glDrawArraysInstanced(t.TRIANGLE_STRIP,0,4,this.attribute_index/10),this.glVertexAttribDivisor(this.a_lineColor_loc,0),this.glVertexAttribDivisor(this.a_lineThicknessAndLength_loc,0),this.glVertexAttribDivisor(this.a_penPoints_loc,0)):t.drawArrays(t.TRIANGLES,0,this.attribute_index/10),this.attribute_index=0,this._silhouetteDirty=!0}onNativeSizeChanged(t){this._nativeSize=t.newSize,this._setCanvasSize([t.newSize[0]*this.renderQuality,t.newSize[1]*this.renderQuality]),this.emitWasAltered()}_setCanvasSize(t){const[e,n]=t;if(this._size&&this._size[0]===e&&this._size[1]===n)return;this._size=t,this._rotationCenter[0]=this._nativeSize[0]/2,this._rotationCenter[1]=this._nativeSize[1]/2;const i=this._renderer.gl,s=this._texture;this._texture=r.createTexture(i,{mag:i.NEAREST,min:i.NEAREST,wrap:i.CLAMP_TO_EDGE,width:e,height:n});const o=[{format:i.RGBA,attachment:this._texture}];this._framebuffer,this._framebuffer=r.createFramebufferInfo(i,o,e,n),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),s&&this._drawPenTexture(s),this._silhouettePixels=new Uint8Array(Math.floor(e*n*4)),this._silhouetteImageData=new ImageData(e,n),this._silhouetteDirty=!0}setRenderQuality(t){this.renderQuality!==t&&(this.renderQuality=t,this._setCanvasSize([Math.round(this._nativeSize[0]*t),Math.round(this._nativeSize[1]*t)]))}updateSilhouette(){if(this._silhouetteDirty){this._renderer.enterDrawRegion(this._usePenBufferDrawRegionId);const t=this._renderer.gl;t.readPixels(0,0,this._size[0],this._size[1],t.RGBA,t.UNSIGNED_BYTE,this._silhouettePixels),this._silhouetteImageData.data.set(this._silhouettePixels),this._silhouette.update(this._silhouetteImageData,!0),this._silhouetteDirty=!1}}}},function(t,e,n){const r=n(10),i=n(25),{loadSvgString:s,serializeSvgToString:o}=n(23),a=n(26);t.exports=class extends i{constructor(t,e){super(t,e),this._svgImage=document.createElement("img"),this._svgImageLoaded=!1,this._size=[0,0],this._canvas=document.createElement("canvas"),this._context=this._canvas.getContext("2d"),this._scaledMIPs=[],this._largestMIPScale=0,this._maxTextureScale=1}dispose(){this.resetMIPs(),super.dispose()}get size(){return[this._size[0],this._size[1]]}useNearest(t,e){return!(e.enabledEffects&(a.EFFECT_INFO.fisheye.mask|a.EFFECT_INFO.whirl.mask|a.EFFECT_INFO.pixelate.mask|a.EFFECT_INFO.mosaic.mask))&&(e._direction%90==0&&(Math.abs(t[0])>99&&Math.abs(t[0])<101&&Math.abs(t[1])>99&&Math.abs(t[1])<101))}createMIP(t){const e=this._largestMIPScale<t;e||this._silhouette.unlazy();const[n,i]=this._size;if(this._canvas.width=n*t,this._canvas.height=i*t,this._canvas.width<=0||this._canvas.height<=0||this._svgImage.naturalWidth<=0||this._svgImage.naturalHeight<=0)return super.getTexture();this._context.clearRect(0,0,this._canvas.width,this._canvas.height),this._context.setTransform(t,0,0,t,0,0),this._context.drawImage(this._svgImage,0,0);const s=this._canvas,o={auto:!1,wrap:this._renderer.gl.CLAMP_TO_EDGE,src:s,premultiplyAlpha:!0},a=r.createTexture(this._renderer.gl,o);return e&&(this._silhouette.update(s),this._largestMIPScale=t),a}updateSilhouette(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[100,100];this.getTexture(t),this._silhouette.unlazy()}getTexture(t){const e=t?Math.max(Math.abs(t[0]),Math.abs(t[1])):100,n=Math.min(e/100,this._maxTextureScale),r=Math.max(Math.ceil(Math.log2(n))+8,0),i=Math.pow(2,r-8);return this._svgImageLoaded&&!this._scaledMIPs[r]&&(this._scaledMIPs[r]=this.createMIP(i)),this._scaledMIPs[r]||super.getTexture()}resetMIPs(){this._scaledMIPs.forEach((t=>this._renderer.gl.deleteTexture(t))),this._scaledMIPs.length=0,this._largestMIPScale=0}setSVG(t,e){const n=s(t),r=o(n,this._renderer.customFonts);this._svgImageLoaded=!1;const{x:i,y:a,width:c,height:u}=n.viewBox.baseVal;this._size[0]=c,this._size[1]=u,this._svgImage.onload=()=>{if(0===c||0===u)return void super.setEmptyImageData();const t=Math.ceil(Math.max(c,u)),n=this._renderer.maxTextureDimension;let r=2;for(;t*r<=n;r*=2)this._maxTextureScale=r;this.resetMIPs(),void 0===e&&(e=this.calculateRotationCenter()),this._rotationCenter[0]=e[0]-i,this._rotationCenter[1]=e[1]-a,this._svgImageLoaded=!0,this.emitWasAltered()},this._svgImage.src="data:image/svg+xml;utf8,".concat(encodeURIComponent(r))}}},function(t,e,n){const r=n(10),i=n(87),s=n(25),o={maxLineWidth:170,minWidth:50,strokeWidth:4,padding:10,cornerRadius:16,tailHeight:12,font:"Helvetica",fontSize:14,fontHeightRatio:.9,lineHeight:16,bubbleFill:"white",bubbleStroke:"rgba(0, 0, 0, 0.15)",textFill:"#575E75"};t.exports=class extends s{constructor(t,e){super(t,e),this._canvas=document.createElement("canvas"),this._size=[0,0],this._renderedScale=0,this._lines=[],this._textAreaSize={width:0,height:0},this._bubbleType="",this._pointsLeft=!1,this._textDirty=!0,this._textureDirty=!0,this._style=o,this.measurementProvider=new i(this._canvas.getContext("2d")),this.textWrapper=e.createTextWrapper(this.measurementProvider),this._restyleCanvas()}dispose(){this._texture&&(this._renderer.gl.deleteTexture(this._texture),this._texture=null),this._canvas=null,super.dispose()}get size(){return this._textDirty&&this._reflowLines(),this._size}setTextBubble(t,e,n){this._text=e,this._bubbleType=t,this._pointsLeft=n,this._textDirty=!0,this._textureDirty=!0,this.emitWasAltered()}setStyle(t){this._style=Object.assign({},this._style,t),this.measurementProvider.clearCache(),this._restyleCanvas(),this._textDirty=!0,this._textureDirty=!0,this.emitWasAltered()}_restyleCanvas(){this._canvas.getContext("2d").font="".concat(this._style.fontSize,"px ").concat(this._style.font,", sans-serif")}_reflowLines(){this._lines=this.textWrapper.wrapText(this._style.maxLineWidth,this._text);let t=0;for(const e of this._lines)t=Math.max(t,this.measurementProvider.measureText(e));const e=Math.max(t,this._style.minWidth)+2*this._style.padding,n=this._style.lineHeight*this._lines.length+2*this._style.padding;this._textAreaSize.width=e,this._textAreaSize.height=n,this._size[0]=e+this._style.strokeWidth,this._size[1]=n+this._style.strokeWidth+this._style.tailHeight,this._textDirty=!1}_renderTextBubble(t){const e=this._canvas.getContext("2d");this._textDirty&&this._reflowLines();const n=this._textAreaSize.width,r=this._textAreaSize.height;this._canvas.width=Math.ceil(this._size[0]*t),this._canvas.height=Math.ceil(this._size[1]*t),this._restyleCanvas(),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,this._canvas.width,this._canvas.height),e.scale(t,t),e.translate(.5*this._style.strokeWidth,.5*this._style.strokeWidth),e.save(),this._pointsLeft&&(e.scale(-1,1),e.translate(-n,0)),e.beginPath(),e.moveTo(this._style.cornerRadius,r),e.arcTo(0,r,0,r-this._style.cornerRadius,this._style.cornerRadius),e.arcTo(0,0,n,0,this._style.cornerRadius),e.arcTo(n,0,n,r,this._style.cornerRadius),e.arcTo(n,r,n-this._style.cornerRadius,r,this._style.cornerRadius),e.save(),e.translate(n-this._style.cornerRadius,r),"say"===this._bubbleType?(e.bezierCurveTo(0,4,4,8,4,10),e.arcTo(4,12,2,12,2),e.bezierCurveTo(-1,12,-11,8,-16,0),e.closePath()):(e.arc(-16,0,4,0,Math.PI),e.closePath(),e.moveTo(-7,7.25),e.arc(-9.25,7.25,2.25,0,2*Math.PI),e.moveTo(0,9.5),e.arc(-1.5,9.5,1.5,0,2*Math.PI)),e.restore(),e.fillStyle=this._style.bubbleFill,e.strokeStyle=this._style.bubbleStroke,e.lineWidth=this._style.strokeWidth,e.stroke(),e.fill(),e.restore(),e.fillStyle=this._style.textFill;const i=this._lines;for(let t=0;t<i.length;t++){const n=i[t];e.fillText(n,this._style.padding,this._style.padding+this._style.lineHeight*t+this._style.fontHeightRatio*this._style.fontSize)}this._renderedScale=t}updateSilhouette(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[100,100];this.getTexture(t)}getTexture(t){const e=t?Math.max(Math.abs(t[0]),Math.abs(t[1])):100,n=Math.min(10,e/100);if(this._textureDirty||this._renderedScale!==n){this._renderTextBubble(n),this._textureDirty=!1;const t=this._canvas.getContext("2d").getImageData(0,0,this._canvas.width,this._canvas.height),e=this._renderer.gl;if(null===this._texture){const t={auto:!1,wrap:e.CLAMP_TO_EDGE};this._texture=r.createTexture(e,t)}this._setTexture(t)}return this._texture}}},function(t,e,n){const r=n(274),i=n(279);t.exports=class{constructor(t){this._measurementProvider=t,this._cache={}}wrapText(t,e){e=e.normalize();const n="".concat(t,"-").concat(e);if(this._cache[n])return this._cache[n];const s=this._measurementProvider.beginMeasurementSession(),o=new r(e);let a,c=0,u=null;const l=[];for(;a=o.nextBreak();){const n=e.slice(c,a.position).replace(/\n+$/,"");let r=(u||"").concat(n),s=this._measurementProvider.measureText(r);if(s>t){if(this._measurementProvider.measureText(n)>t){let e,o=0;for(;o!==(e=i.nextBreak(n,o));){const i=n.substring(o,e);r=(u||"").concat(i),s=this._measurementProvider.measureText(r),null===u||s<=t?u=r:(l.push(u),u=i),o=e}}else null!==u&&l.push(u),u=n}else u=r;a.required&&(null!==u&&l.push(u),u=null),c=a.position}return u=u||"",(u.length>0||0===l.length)&&l.push(u),this._cache[n]=l,this._measurementProvider.endMeasurementSession(s),l}}},function(t,e,n){(function(){var e,r,i,s,o,a,c,u,l,h,d,p,f,m,g,b,y,v,w,T,E,A,k,I,S,x,O;w=n(88),A=n(276),x=n(277),x.BK,l=x.CR,x.LF,x.NL,o=x.CB,i=x.BA,x.SP,T=x.WJ,v=x.SP,s=x.BK,p=x.LF,m=x.NL,e=x.AI,r=x.AL,b=x.SA,y=x.SG,E=x.XX,c=x.CJ,x.ID,g=x.NS,x.characterClasses,O=n(278),h=O.DI_BRK,d=O.IN_BRK,a=O.CI_BRK,u=O.CP_BRK,O.PR_BRK,S=O.pairTable,I=A.toByteArray(" "),k=new w(I),f=function(){var t,n,f;function w(t){this.string=t,this.pos=0,this.lastPos=0,this.curClass=null,this.nextClass=null}return w.prototype.nextCodePoint=function(){var t,e;return t=this.string.charCodeAt(this.pos++),e=this.string.charCodeAt(this.pos),55296<=t&&t<=56319&&56320<=e&&e<=57343?(this.pos++,1024*(t-55296)+(e-56320)+65536):t},n=function(t){switch(t){case e:case b:case y:case E:return r;case c:return g;default:return t}},f=function(t){switch(t){case p:case m:return s;case o:return i;case v:return T;default:return t}},w.prototype.nextCharClass=function(t){return null==t&&(t=!1),n(k.get(this.nextCodePoint()))},t=function(t,e){this.position=t,this.required=null!=e&&e},w.prototype.nextBreak=function(){var e,r,c;for(null==this.curClass&&(this.curClass=f(this.nextCharClass()));this.pos<this.string.length;){if(this.lastPos=this.pos,r=this.nextClass,this.nextClass=this.nextCharClass(),this.curClass===s||this.curClass===l&&this.nextClass!==p)return this.curClass=f(n(this.nextClass)),new t(this.lastPos,!0);if(null==(e=function(){switch(this.nextClass){case v:return this.curClass;case s:case p:case m:return s;case l:return l;case o:return i}}.call(this))){switch(c=!1,S[this.curClass][this.nextClass]){case h:c=!0;break;case d:c=r===v;break;case a:if(!(c=r===v))continue;break;case u:if(r!==v)continue}if(this.curClass=this.nextClass,c)return new t(this.lastPos)}else if(this.curClass=e,this.nextClass===o)return new t(this.lastPos)}if(this.pos>=this.string.length)return this.lastPos<this.string.length?(this.lastPos=this.string.length,new t(this.string.length)):null},w}(),t.exports=f}).call(this)},function(t,e){function n(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function r(t,e){this.source=t,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new n,this.dtree=new n}var i=new n,s=new n,o=new Uint8Array(30),a=new Uint16Array(30),c=new Uint8Array(30),u=new Uint16Array(30),l=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),h=new n,d=new Uint8Array(320);function p(t,e,n,r){var i,s;for(i=0;i<n;++i)t[i]=0;for(i=0;i<30-n;++i)t[i+n]=i/n|0;for(s=r,i=0;i<30;++i)e[i]=s,s+=1<<t[i]}var f=new Uint16Array(16);function m(t,e,n,r){var i,s;for(i=0;i<16;++i)t.table[i]=0;for(i=0;i<r;++i)t.table[e[n+i]]++;for(t.table[0]=0,s=0,i=0;i<16;++i)f[i]=s,s+=t.table[i];for(i=0;i<r;++i)e[n+i]&&(t.trans[f[e[n+i]]++]=i)}function g(t){t.bitcount--||(t.tag=t.source[t.sourceIndex++],t.bitcount=7);var e=1&t.tag;return t.tag>>>=1,e}function b(t,e,n){if(!e)return n;for(;t.bitcount<24;)t.tag|=t.source[t.sourceIndex++]<<t.bitcount,t.bitcount+=8;var r=t.tag&65535>>>16-e;return t.tag>>>=e,t.bitcount-=e,r+n}function y(t,e){for(;t.bitcount<24;)t.tag|=t.source[t.sourceIndex++]<<t.bitcount,t.bitcount+=8;var n=0,r=0,i=0,s=t.tag;do{r=2*r+(1&s),s>>>=1,++i,n+=e.table[i],r-=e.table[i]}while(r>=0);return t.tag=s,t.bitcount-=i,e.trans[n+r]}function v(t,e,n){var r,i,s,o,a,c;for(r=b(t,5,257),i=b(t,5,1),s=b(t,4,4),o=0;o<19;++o)d[o]=0;for(o=0;o<s;++o){var u=b(t,3,0);d[l[o]]=u}for(m(h,d,0,19),a=0;a<r+i;){var p=y(t,h);switch(p){case 16:var f=d[a-1];for(c=b(t,2,3);c;--c)d[a++]=f;break;case 17:for(c=b(t,3,3);c;--c)d[a++]=0;break;case 18:for(c=b(t,7,11);c;--c)d[a++]=0;break;default:d[a++]=p}}m(e,d,0,r),m(n,d,r,i)}function w(t,e,n){for(;;){var r,i,s,l,h=y(t,e);if(256===h)return 0;if(h<256)t.dest[t.destLen++]=h;else for(r=b(t,o[h-=257],a[h]),i=y(t,n),l=s=t.destLen-b(t,c[i],u[i]);l<s+r;++l)t.dest[t.destLen++]=t.dest[l]}}function T(t){for(var e,n;t.bitcount>8;)t.sourceIndex--,t.bitcount-=8;if((e=256*(e=t.source[t.sourceIndex+1])+t.source[t.sourceIndex])!==(65535&~(256*t.source[t.sourceIndex+3]+t.source[t.sourceIndex+2])))return-3;for(t.sourceIndex+=4,n=e;n;--n)t.dest[t.destLen++]=t.source[t.sourceIndex++];return t.bitcount=0,0}!function(t,e){var n;for(n=0;n<7;++n)t.table[n]=0;for(t.table[7]=24,t.table[8]=152,t.table[9]=112,n=0;n<24;++n)t.trans[n]=256+n;for(n=0;n<144;++n)t.trans[24+n]=n;for(n=0;n<8;++n)t.trans[168+n]=280+n;for(n=0;n<112;++n)t.trans[176+n]=144+n;for(n=0;n<5;++n)e.table[n]=0;for(e.table[5]=32,n=0;n<32;++n)e.trans[n]=n}(i,s),p(o,a,4,3),p(c,u,2,1),o[28]=0,a[28]=258,t.exports=function(t,e){var n,o,a=new r(t,e);do{switch(n=g(a),b(a,2,0)){case 0:o=T(a);break;case 1:o=w(a,i,s);break;case 2:v(a,a.ltree,a.dtree),o=w(a,a.ltree,a.dtree);break;default:o=-3}if(0!==o)throw new Error("Data error")}while(!n);return a.destLen<a.dest.length?"function"==typeof a.dest.slice?a.dest.slice(0,a.destLen):a.dest.subarray(0,a.destLen):a.dest}},function(t,e,n){!function(t){"use strict";var e="undefined"!=typeof Uint8Array?Uint8Array:Array,n="+".charCodeAt(0),r="/".charCodeAt(0),i="0".charCodeAt(0),s="a".charCodeAt(0),o="A".charCodeAt(0),a="-".charCodeAt(0),c="_".charCodeAt(0);function u(t){var e=t.charCodeAt(0);return e===n||e===a?62:e===r||e===c?63:e<i?-1:e<i+10?e-i+26+26:e<o+26?e-o:e<s+26?e-s+26:void 0}t.toByteArray=function(t){var n,r,i,s,o,a;if(t.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var c=t.length;o="="===t.charAt(c-2)?2:"="===t.charAt(c-1)?1:0,a=new e(3*t.length/4-o),i=o>0?t.length-4:t.length;var l=0;function h(t){a[l++]=t}for(n=0,r=0;n<i;n+=4,r+=3)h((16711680&(s=u(t.charAt(n))<<18|u(t.charAt(n+1))<<12|u(t.charAt(n+2))<<6|u(t.charAt(n+3))))>>16),h((65280&s)>>8),h(255&s);return 2===o?h(255&(s=u(t.charAt(n))<<2|u(t.charAt(n+1))>>4)):1===o&&(h((s=u(t.charAt(n))<<10|u(t.charAt(n+1))<<4|u(t.charAt(n+2))>>2)>>8&255),h(255&s)),a},t.fromByteArray=function(t){var e,n,r,i,s=t.length%3,o="";function a(t){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)}for(e=0,r=t.length-s;e<r;e+=3)n=(t[e]<<16)+(t[e+1]<<8)+t[e+2],o+=a((i=n)>>18&63)+a(i>>12&63)+a(i>>6&63)+a(63&i);switch(s){case 1:o+=a((n=t[t.length-1])>>2),o+=a(n<<4&63),o+="==";break;case 2:o+=a((n=(t[t.length-2]<<8)+t[t.length-1])>>10),o+=a(n>>4&63),o+=a(n<<2&63),o+="="}return o}}(e)},function(t,e){(function(){e.OP=0,e.CL=1,e.CP=2,e.QU=3,e.GL=4,e.NS=5,e.EX=6,e.SY=7,e.IS=8,e.PR=9,e.PO=10,e.NU=11,e.AL=12,e.HL=13,e.ID=14,e.IN=15,e.HY=16,e.BA=17,e.BB=18,e.B2=19,e.ZW=20,e.CM=21,e.WJ=22,e.H2=23,e.H3=24,e.JL=25,e.JV=26,e.JT=27,e.RI=28,e.AI=29,e.BK=30,e.CB=31,e.CJ=32,e.CR=33,e.LF=34,e.NL=35,e.SA=36,e.SG=37,e.SP=38,e.XX=39}).call(this)},function(t,e){(function(){e.DI_BRK=0,e.IN_BRK=1,e.CI_BRK=2,e.CP_BRK=3,e.PR_BRK=4,e.pairTable=[[4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,4,4,4,4,4,4,4],[0,4,4,1,1,4,4,4,4,1,1,0,0,0,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,1,4,4,4,4,1,1,1,1,1,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[4,4,4,1,1,1,4,4,4,1,1,1,1,1,1,1,1,1,1,1,4,2,4,1,1,1,1,1,1],[1,4,4,1,1,1,4,4,4,1,1,1,1,1,1,1,1,1,1,1,4,2,4,1,1,1,1,1,1],[0,4,4,1,1,1,4,4,4,0,0,0,0,0,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,1,1,4,4,4,0,0,0,0,0,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,1,1,4,4,4,0,0,1,0,0,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,1,1,4,4,4,0,0,1,1,1,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,0,0,1,1,1,1,0,1,1,0,0,4,2,4,1,1,1,1,1,0],[1,4,4,1,1,1,4,4,4,0,0,1,1,1,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,1,1,1,1,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,0,0,1,1,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,0,0,1,1,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,1,1,4,4,4,0,0,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,0,1,4,4,4,0,0,1,0,0,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,0,1,4,4,4,0,0,0,0,0,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,1,1,1,1,1,1,1,1,1,1,1,4,2,4,1,1,1,1,1,1],[0,4,4,1,1,1,4,4,4,0,0,0,0,0,0,0,1,1,0,4,4,2,4,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,0,0,1,1,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,1,1,1,1,1,1,1,1,1,1,1,4,2,4,1,1,1,1,1,1],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,1,1,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,1,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,1,1,1,1,0,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,1,1,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,1,0],[0,4,4,1,1,1,4,4,4,0,0,0,0,0,0,0,1,1,0,0,4,2,4,0,0,0,0,0,1]]}).call(this)},function(t,e,n){(function(t){(function(){var r,i,s,o,a,c,u,l,h,d,p,f,m,g,b,y;y=n(280),r=y.CR,a=y.LF,i=y.Control,s=y.Extend,l=y.Regional_Indicator,h=y.SpacingMark,o=y.L,f=y.V,d=y.T,c=y.LV,u=y.LVT,p=n(88),m=new p(t("AA4QAAAAAAAAAHbgAQgG9/ntmkuIXjUUxzN+r3k4bUWQVotSHVCsoov6qIoiToWKFYvMuLHVtlaoLqQilLrwtakuxFYoLmQQYWalRYpUKYJV0am4mMUooojgSEG7EC2CdiHq/3rzMcc0yT333jyu0xz4kdwkN+ckOXncfN9QS4jzwCqwBqwHt5O0uuFGsBlsAhOM8lvATkv+LrAb7AXPgRfBAfAqeJ2UmwZvgcPgKDgGjoNZMAe+AN+C5W0hLgAXtvN3KZci7UpwFVgHbgHjYAPYJJ8nwCTYCnaQ58dI+cfBHvn8DFgL9kl9LyP8LLOflJ8CM+Q5K39IPo/28vfeyd6X8fcR/5jYP4v4nHyeR/iNjC8gPAl+BU+T8qcRFx0hBsGKzn/74LreIrdKxsGkRO0zE48wy7lmZSfnYkmWdhnCtTK+oHnnWqUPbuyY679N5t2J8B4ZnyTltyK+Dezq5P62G+Femf+sDPdp6n8JaQcterN5NWXJ5/Ij+FnGR0n6BvCbZk4kwjGjjO8rGh9woedNoudtBz6VSCQSiUQikUgkEomET97t5Hdp/ecvGfcXH+CdWfLNu6onxGowh7SvZPp3CE+A63v5feBJxMcQPyXz/0D4N2h18+cRhEcQnt+1674I+Q+inofANrAd7AAPg529lJfyUl7KS3mu8+4G94H7e/H3rPWRid3+RGIpc0nBGbAuE63F39VV1mjS6Pn4VCv++jN9bs4JMM5gbFSIdaNnpj+ppE3j+QQYWybEA8vytP0IPwF/gpXLsQ+AhWH0xYgQPwwJMTjA46YRXrnVw4vxzYjvke8dzvQx60gkEonE0uQA9oU3wB04J7yH/fDDVv4/j+x/QqfJXv0RuEueJe7t5vkTCLeQ88V2zVkjq+tRpD/Rzf+39hTC55lnkhdQbr+l7EHkTZH8GcTnSf4hkpf9/+uI57NQFT6HTSsC6hMYg3no/FrTF983sH84FJ3xNlroteOfQWNTp+8vL/CZeeX5mgb62A2w6WaDXa/9D/6DeFTafqwBfXtFT4irwacObMnm50/dPPwF4e/grwa0kUsTxiMEnQbcY9ZlsDXwL4iyOIfEB5jvcEgST1L/u/PjkP7vctzaZzkuJZSepknsMaw67jQ0xZe61F2XyvZ5k/ecJq4voXzQ1oZWQRm1Dl1ZH0LtiiVN8pUmy9nQD77bppuTLqWl1O9Ch+9vv9Dfm12COrZqOrXRJv13TX6i00XHyISLNamp3/e6eWWab9xyoYSr1+XeUoWug7ZWFTonhLDPO9M8pOX7cVHwbhn7Yu1VantC61ZtMPWhaiMtX0YXp1wsf7X5p65sW/OslnXpV3XrN803WneXlC0zvj5EZ5sP/6yyXsQQ01rRVdJV/+XWXUZ/rPmp7gf9dNuZoKjOmOOZibqv6fY43fi6bp9pfoXyL1tZ0x5Fy6u+UcVOrm1FZxdOPS7OLi7sFaKaXt+2c/X71qELqbhcD4v8wgRnb6+rr459rqgr3H5T21tmza0r3LOnj/6oWkcmnP6pa7OPvve9dvmqm+PD1HdteyP3e7xsX/mcK7Y26tJV0bXfVI/vOa9bZ3wIbS9nraehKHiH248cn/KxtpX1bV3bQoptnGx+S9ND2xujn6jo+ku3Jvic16oO3djo7CsrnHWdM1dd9UPR/OFQ9rtKl2ZaQ4vaWWe9KGOzSV8dcenPZdvhUny1QZdW1ce4fuhSdGuYb/F1h8IV3/PPlR0+pOya6dofdPuDbt8oug9uis+YvguqjiHnnVDz1KbfR30637f1Y5U+1o2VrVxZMX37qvfcof1XJzFtCKG76plJCJ7fhTq/FJ0hqI/FFtMaGWOv69vjUsrePZTZQ331h8lm07dj1fpCn2Fi3EX09atn2L6Ynsv4AFfUernj4HucbGc8dU0w+aDL+4M6YmtLX0z3I7Ha4Fpn1bufKucck2/YfIhrP3dfci0h5puv9TfUPs21g8bbmvzQZ4tQfhNSiuZ4HVzp4rShTHt9icl2l31YVTqB6Eus81pd/U2xuwyxpYrNPsik1wCoDEZmyDMjCmXFZVtV8d12DqoMizP7zCeh9anyDw==","base64")),g=function(t,e){var n,r,i;return e=e||0,55296<=(n=t.charCodeAt(e))&&n<=56319?(r=n,56320<=(i=t.charCodeAt(e+1))&&i<=57343?1024*(r-55296)+(i-56320)+65536:r):56320<=n&&n<=57343?(i=n,55296<=(r=t.charCodeAt(e-1))&&r<=56319?1024*(r-55296)+(i-56320)+65536:i):n},b=function(t,e){return(t!==r||e!==a)&&(t===i||t===r||t===a||(e===i||e===r||e===a||(t!==o||e!==o&&e!==f&&e!==c&&e!==u)&&((t!==c&&t!==f||e!==f&&e!==d)&&((t!==u&&t!==d||e!==d)&&((t!==l||e!==l)&&(e!==s&&e!==h))))))},e.nextBreak=function(t,e){var n,r,i,s,o,a,c;if(null==e&&(e=0),e<0)return 0;if(e>=t.length-1)return t.length;for(i=m.get(g(t,e)),n=s=e+1,o=t.length;s<o;n=s+=1)if(!(55296<=(a=t.charCodeAt(n-1))&&a<=56319&&56320<=(c=t.charCodeAt(n))&&c<=57343)){if(r=m.get(g(t,n)),b(i,r))return n;i=r}return t.length},e.previousBreak=function(t,e){var n,r,i,s,o,a;if(null==e&&(e=t.length),e>t.length)return t.length;if(e<=1)return 0;for(e--,r=m.get(g(t,e)),n=s=e-1;s>=0;n=s+=-1)if(!(55296<=(o=t.charCodeAt(n))&&o<=56319&&56320<=(a=t.charCodeAt(n+1))&&a<=57343)){if(i=m.get(g(t,n)),b(i,r))return n+1;r=i}return 0},e.break=function(t){var n,r,i;for(i=[],r=0;(n=e.nextBreak(t,r))<t.length;)i.push(t.slice(r,n)),r=n;return r<t.length&&i.push(t.slice(r)),i},e.countBreaks=function(t){var n,r,i;for(r=0,i=0;(n=e.nextBreak(t,i))<t.length;)i=n,r++;return i<t.length&&r++,r}}).call(this)}).call(this,n(16).Buffer)},function(t){t.exports=JSON.parse('{"Other":0,"CR":1,"LF":2,"Control":3,"Extend":4,"Regional_Indicator":5,"SpacingMark":6,"L":7,"V":8,"T":9,"LV":10,"LVT":11}')},function(t,e){t.exports=".scratch-render-overlays {\n    position: absolute;\n    top: 0;\n    left: 0;\n    pointer-events: none;\n    overflow: hidden;\n}\n.scratch-render-overlays > * {\n    position: absolute;\n    top: 0;\n    left: 0;\n}\n"},function(t,e,n){const r=n(283),i=n(33),s=n(285),o=n(286),a=n(288),c=n(289),u=n(290),l=n(291),h=n(292),d=n(91),p=n(293);t.exports=class{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(()=>{const t=window.AudioContext||window.webkitAudioContext;if(!t)throw new Error("Browser does not support AudioContext");return new t})();this.audioContext=t,this.inputNode=this.audioContext.createGain(),this.inputNode.connect(this.audioContext.destination),this.audioBuffers={},this.loudness=null,this.effects=[l,h,d],r(this.audioContext)}get currentTime(){return this.audioContext.currentTime}get EFFECT_NAMES(){return{pitch:"pitch",pan:"pan"}}get DECAY_DURATION(){return.025}get DECAY_WAIT(){return.05}getInputNode(){return this.inputNode}_decodeSound(t){const e=t.data.buffer.slice(0),n=s();var r,a;return(r=this.audioContext,a=e,1===r.decodeAudioData.length?r.decodeAudioData(a):new Promise(((t,e)=>{r.decodeAudioData(a,(e=>t(e)),(t=>e(t)))}))).catch((()=>{if(0===t.data.length)return this._emptySound();const e=t.data.buffer.slice(0);return new o(this.audioContext).decode(e).catch((()=>this._emptySound()))})).then((t=>[n,t]),(t=>{i.warn("audio data could not be decoded",t)}))}_emptySound(){return this.audioContext.createBuffer(1,1,this.audioContext.sampleRate)}decodeSound(t){return this._decodeSound(t).then((t=>{let[e,n]=t;return this.audioBuffers[e]=n,e}))}decodeSoundPlayer(t){return this._decodeSound(t).then((t=>{let[e,n]=t;return new c(this,{id:e,buffer:n})}))}getLoudness(){return this.loudness||(this.loudness=new a(this.audioContext)),this.loudness.getLoudness()}createEffectChain(){const t=new u(this,this.effects);return t.connect(this),t}createBank(){return new p(this,this.createEffectChain())}}},function(t,e,n){const r=n(284);t.exports=function(t){if("undefined"!=typeof document)return r(t)}},function(t,e){const n=["mousedown","mouseup","keydown","keyup","touchstart","touchend"];t.exports=t=>{if("running"===t.state)return;const e=()=>{"running"===t.state&&(()=>{t.removeEventListener("statechange",e);for(const t of n)document.body.removeEventListener(t,r)})()};t.addEventListener("statechange",e);const r=()=>{t.resume()};for(const t of n)document.body.addEventListener(t,r)}},function(t,e){const n="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";t.exports=function(){const t=n.length,e=[];for(let r=0;r<20;r++)e[r]=n.charAt(Math.random()*t);return e.join("")}},function(t,e,n){const r=n(287),i=n(33),s=[7,8,9,10,11,12,13,14,16,17,19,21,23,25,28,31,34,37,41,45,50,55,60,66,73,80,88,97,107,118,130,143,157,173,190,209,230,253,279,307,337,371,408,449,494,544,598,658,724,796,876,963,1060,1166,1282,1411,1552,1707,1878,2066,2272,2499,2749,3024,3327,3660,4026,4428,4871,5358,5894,6484,7132,7845,8630,9493,10442,11487,12635,13899,15289,16818,18500,20350,22385,24623,27086,29794,32767],o=[-1,-1,-1,-1,2,4,6,8,-1,-1,-1,-1,2,4,6,8];let a=null;t.exports=class{constructor(t){this.audioContext=t}static get STEP_TABLE(){return s}static get INDEX_TABLE(){return o}decode(t){return new Promise(((e,n)=>{const s=new r(t);"RIFF"!==s.readUint8String(4)&&(i.warn("incorrect adpcm wav header"),n(new Error("incorrect adpcm wav header")));const o=s.readInt32();o+8!==t.byteLength&&i.warn("adpcm wav length in header: ".concat(o," is incorrect"));"WAVE"!==s.readUint8String(4)&&(i.warn("incorrect adpcm wav header"),n(new Error("incorrect adpcm wav header")));const a=this.extractChunk("fmt ",s);this.encoding=a.readUint16(),this.channels=a.readUint16(),this.samplesPerSecond=a.readUint32(),this.bytesPerSecond=a.readUint32(),this.blockAlignment=a.readUint16(),this.bitsPerSample=a.readUint16(),a.position+=2,this.samplesPerBlock=a.readUint16(),this.adpcmBlockSize=(this.samplesPerBlock-1)/2+4;const c=this.extractChunk("data",s),u=this.numberOfSamples(c,this.adpcmBlockSize),l=this.audioContext.createBuffer(1,u,this.samplesPerSecond);this.imaDecompress(c,this.adpcmBlockSize,l.getChannelData(0)),e(l)}))}extractChunk(t,e){for(e.position=12;e.position<e.getLength()-8;){const n=e.readUint8String(4),r=e.readInt32();if(n===t){return e.extract(r)}e.position+=r}}numberOfSamples(t,e){if(!t)return 0;t.position=0;const n=t.getBytesAvailable();return(n/e|0)*(2*(e-4))+1+2*Math.max(n%e-4,0)+Math.min(n%e,1)}imaDecompress(t,e,n){let r,i,c,u=0,l=-1;if(!t)return;t.position=0;const h=n.length,d=2*(e-4),p=function(){if(null===a){const t=s.length,e=o.length;a=new Array(t*e).fill(0);let n=0;for(let r=0;r<t;r++)for(let t=0;t<e;t++){const e=s[r];let i=0;4&t&&(i+=e),2&t&&(i+=e>>1),1&t&&(i+=e>>2),i+=e>>3,a[n++]=8&t?-i:i}}return a}();let f=0;for(;f<h;){r=t.readInt16(),u=t.readUint8(),t.position++,u>88&&(u=88),n[f++]=r/32768;const e=Math.min(d,h-f),s=f;for(;f-s<e;)l=t.readUint8(),i=15&l,c=p[16*u+i],u+=o[i],u>88?u=88:u<0&&(u=0),r+=c,r>32767?r=32767:r<-32768&&(r=-32768),n[f++]=r/32768,i=l>>4&15,c=p[16*u+i],u+=o[i],u>88?u=88:u<0&&(u=0),r+=c,r>32767?r=32767:r<-32768&&(r=-32768),n[f++]=r/32768}}}},function(t,e){class n{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.byteLength,{_uint8View:r=new Uint8Array(t)}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this.arrayBuffer=t,this.start=e,this.end=n,this._uint8View=r,this._position=e}extract(t){return new n(this.arrayBuffer,this._position,this._position+t,this)}getLength(){return this.end-this.start}getBytesAvailable(){return this.end-this._position}get position(){return this._position-this.start}set position(t){this._position=t+this.start}readUint8(){const t=this._uint8View[this._position];return this._position+=1,t}readUint8String(t){const e=this._uint8View;let n="";const r=this._position+t;for(let t=this._position;t<r;t++)n+=String.fromCharCode(e[t]);return this._position+=t,n}readInt16(){const t=new Int16Array(this.arrayBuffer,this._position,1)[0];return this._position+=2,t}readUint16(){const t=new Uint16Array(this.arrayBuffer,this._position,1)[0];return this._position+=2,t}readInt32(){let t;return t=this._position%4==0?new Int32Array(this.arrayBuffer,this._position,1)[0]:new Int32Array(this.arrayBuffer.slice(this._position,this._position+4))[0],this._position+=4,t}readUint32(){const t=new Uint32Array(this.arrayBuffer,this._position,1)[0];return this._position+=4,t}}t.exports=n},function(t,e,n){const r=n(33);t.exports=class{constructor(t){this.audioContext=t,this.connectingToMic=!1,this.mic=null}getLoudness(){if(this.mic||this.connectingToMic||(this.connectingToMic=!0,navigator.mediaDevices.getUserMedia({audio:!0}).then((t=>{this.audioStream=t,this.mic=this.audioContext.createMediaStreamSource(t),this.analyser=this.audioContext.createAnalyser(),this.mic.connect(this.analyser),this.micDataArray=new Float32Array(this.analyser.fftSize)})).catch((t=>{r.warn(t)}))),this.mic&&this.audioStream.active){this.analyser.getFloatTimeDomainData(this.micDataArray);let t=0;for(let e=0;e<this.micDataArray.length;e++)t+=Math.pow(this.micDataArray[e],2);let e=Math.sqrt(t/this.micDataArray.length);return this._lastValue&&(e=Math.max(e,.6*this._lastValue)),this._lastValue=e,e*=1.63,e=Math.sqrt(e),e=Math.round(100*e),e=Math.min(e,100),e}return-1}}},function(t,e,n){const{EventEmitter:r}=n(17),i=n(91),s="ended";class o extends r{constructor(t,e){let{id:n,buffer:r}=e;super(),this.id=n,this.audioEngine=t,this.buffer=r,this.outputNode=null,this.volumeEffect=null,this.target=null,this.initialized=!1,this.isPlaying=!1,this.startingUntil=0,this.playbackRate=1,this.handleEvent=this.handleEvent.bind(this)}get isStarting(){return this.isPlaying&&this.startingUntil>this.audioEngine.currentTime}handleEvent(t){t.type===s&&this.onEnded()}onEnded(){this.emit("stop"),this.isPlaying=!1}_createSource(){null!==this.outputNode&&(this.outputNode.removeEventListener(s,this.handleEvent),this.outputNode.disconnect()),this.outputNode=this.audioEngine.audioContext.createBufferSource(),this.outputNode.playbackRate.value=this.playbackRate,this.outputNode.buffer=this.buffer,this.outputNode.addEventListener(s,this.handleEvent),null!==this.target&&this.connect(this.target)}initialize(){this.initialized=!0,this._createSource()}connect(t){return t===this.volumeEffect?(this.outputNode.disconnect(),void this.outputNode.connect(this.volumeEffect.getInputNode())):(this.target=t,this.initialized?(null===this.volumeEffect?(this.outputNode.disconnect(),this.outputNode.connect(t.getInputNode())):this.volumeEffect.connect(t),this):void 0)}dispose(){this.initialized&&(this.stopImmediately(),null!==this.volumeEffect&&(this.volumeEffect.dispose(),this.volumeEffect=null),this.outputNode.disconnect(),this.outputNode=null,this.target=null,this.initialized=!1)}take(){this.outputNode&&this.outputNode.removeEventListener(s,this.handleEvent);const t=new o(this.audioEngine,this);return t.playbackRate=this.playbackRate,this.isPlaying&&(t.startingUntil=this.startingUntil,t.isPlaying=this.isPlaying,t.initialized=this.initialized,t.outputNode=this.outputNode,t.outputNode.addEventListener(s,t.handleEvent),t.volumeEffect=this.volumeEffect,t.volumeEffect&&(t.volumeEffect.audioPlayer=t),null!==this.target&&t.connect(this.target),this.emit("stop"),t.emit("play")),this.outputNode=null,this.volumeEffect=null,this.initialized=!1,this.startingUntil=0,this.isPlaying=!1,t}play(){if(this.isStarting)return this.emit("stop"),void this.emit("play");this.isPlaying&&this.stop(),this.initialized?this._createSource():this.initialize(),this.outputNode.start(),this.isPlaying=!0;const{currentTime:t,DECAY_DURATION:e}=this.audioEngine;this.startingUntil=t+e,this.emit("play")}stop(){if(!this.isPlaying)return;const t=this.take();t.volumeEffect=new i(t.audioEngine,t,null),t.volumeEffect.connect(t.target),t.finished().then((()=>t.dispose())),t.volumeEffect.set(0);const{currentTime:e,DECAY_DURATION:n}=this.audioEngine;t.outputNode.stop(e+n)}stopImmediately(){this.isPlaying&&(this.outputNode.stop(),this.isPlaying=!1,this.startingUntil=0,this.emit("stop"))}finished(){return new Promise((t=>{this.once("stop",t)}))}setPlaybackRate(t){this.playbackRate=t,this.initialized&&(this.outputNode.playbackRate.value=t)}}t.exports=o},function(t,e){class n{constructor(t,e){this.audioEngine=t,this.inputNode=this.audioEngine.audioContext.createGain(),this.effects=e;let n=null;this._effects=e.reverse().map((e=>{const r=new e(t,this,n);return this[r.name]=r,n=r,r})).reverse(),this.firstEffect=this._effects[0],this.lastEffect=this._effects[this._effects.length-1],this._soundPlayers=new Set}clone(){const t=new n(this.audioEngine,this.effects);return this.target&&t.connect(this.target),t}addSoundPlayer(t){this._soundPlayers.has(t)||(this._soundPlayers.add(t),this.update())}removeSoundPlayer(t){this._soundPlayers.remove(t)}getInputNode(){return this.inputNode}connect(t){const{firstEffect:e,lastEffect:n}=this;if(t===n)return this.inputNode.disconnect(),void this.inputNode.connect(n.getInputNode());t!==e&&(this.target=t,e.connect(t))}getSoundPlayers(){return[...this._soundPlayers]}setEffectsFromTarget(t){this._effects.forEach((e=>{"soundEffects"in t&&e.name in t.soundEffects?e.set(t.soundEffects[e.name]):e.name in t&&e.set(t[e.name])}))}set(t,e){t in this&&this[t].set(e)}update(){this._effects.forEach((t=>t.update()))}clear(){this._effects.forEach((t=>t.clear()))}dispose(){this._soundPlayers=null,this._effects.forEach((t=>t.dispose())),this._effects=null}}t.exports=n},function(t,e,n){const r=n(50);t.exports=class extends r{constructor(t,e,n){super(t,e,n),this.leftGain=null,this.rightGain=null,this.channelMerger=null}get name(){return"pan"}initialize(){const t=this.audioEngine.audioContext;this.inputNode=t.createGain(),this.leftGain=t.createGain(),this.rightGain=t.createGain(),this.channelMerger=t.createChannelMerger(2),this.outputNode=this.channelMerger,this.inputNode.connect(this.leftGain),this.inputNode.connect(this.rightGain),this.leftGain.connect(this.channelMerger,0,0),this.rightGain.connect(this.channelMerger,0,1),this.initialized=!0}_set(t){this.value=t;const e=(t+100)/200,n=Math.cos(e*Math.PI/2),r=Math.sin(e*Math.PI/2),{currentTime:i,DECAY_WAIT:s,DECAY_DURATION:o}=this.audioEngine;this.leftGain.gain.setTargetAtTime(n,i+s,o),this.rightGain.gain.setTargetAtTime(r,i+s,o)}dispose(){this.initialized&&(this.inputNode.disconnect(),this.leftGain.disconnect(),this.rightGain.disconnect(),this.channelMerger.disconnect(),this.inputNode=null,this.leftGain=null,this.rightGain=null,this.channelMerger=null,this.outputNode=null,this.target=null,this.initialized=!1)}}},function(t,e,n){const r=n(50);t.exports=class extends r{constructor(t,e,n){super(t,e,n),this.ratio=1}get name(){return"pitch"}get _isPatch(){return!1}getInputNode(){return this.target.getInputNode()}initialize(){this.initialized=!0}_set(t){this.value=t,this.ratio=this.getRatio(this.value),this.updatePlayers(this.audioPlayer.getSoundPlayers())}update(){this.updatePlayers(this.audioPlayer.getSoundPlayers())}getRatio(t){const e=t/10;return Math.pow(2,e/12)}updatePlayer(t){t.setPlaybackRate(this.ratio)}updatePlayers(t){if(t)for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&this.updatePlayer(t[e])}}},function(t,e,n){const r=n(33);t.exports=class{constructor(t,e){this.audioEngine=t,this.soundPlayers={},this.playerTargets=new Map,this.soundEffects=new Map,this.effectChainPrime=e}addSoundPlayer(t){this.soundPlayers[t.id]=t}getSoundPlayer(t){return this.soundPlayers[t]||r.error("SoundBank.getSoundPlayer(".concat(t,"): called missing sound in bank")),this.soundPlayers[t]}getSoundEffects(t){return this.soundEffects.has(t)||this.soundEffects.set(t,this.effectChainPrime.clone()),this.soundEffects.get(t)}playSound(t,e){const n=this.getSoundEffects(e),r=this.getSoundPlayer(e);return this.playerTargets.get(e)!==t&&r.stop(),this.playerTargets.set(e,t),n.addSoundPlayer(r),n.setEffectsFromTarget(t),r.connect(n),r.play(),r.finished()}setEffects(t){this.playerTargets.forEach(((e,n)=>{e===t&&this.getSoundEffects(n).setEffectsFromTarget(t)}))}stop(t,e){this.playerTargets.get(e)===t&&this.soundPlayers[e].stop()}stopAllSounds(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*";this.playerTargets.forEach(((e,n)=>{"*"!==t&&e!==t||this.getSoundPlayer(n).stop()}))}dispose(){this.playerTargets.clear(),this.soundEffects.forEach((t=>t.dispose())),this.soundEffects.clear();for(const t in this.soundPlayers)Object.prototype.hasOwnProperty.call(this.soundPlayers,t)&&this.soundPlayers[t].dispose();this.soundPlayers={}}}},function(t,e,n){"use strict";n.r(e),n.d(e,"SB1File",(function(){return se})),n.d(e,"AssertionError",(function(){return r})),n.d(e,"ValidationError",(function(){return i}));class r extends Error{}class i extends r{}const s=function(t,e){if(!t)throw new r(e)};s.validate=function(t,e){if(!t)throw new i(e)};class o{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.buffer=t,this.position=e,this.uint8a=new Uint8Array(this.buffer)}read(t){const e=t.read(this.uint8a,this.position);return 0===t.size?this.position+=t.sizeOf(this.uint8a,this.position):this.position+=t.size,e}readStruct(t){const e=new t(this.uint8a,this.position);return this.position+=t.size,e}resize(t){if(this.buffer.byteLength<t){const e=this.uint8a,n=Math.pow(2,Math.ceil(Math.log(t)/Math.log(2)));this.buffer=new ArrayBuffer(n),this.uint8a=new Uint8Array(this.buffer),this.uint8a.set(e)}}write(t,e){return 0===t.size?this.resize(this.position+t.writeSizeOf(e)):this.resize(this.position+t.size),t.write(this.uint8a,this.position,e),0===t.size?this.position+=t.writeSizeOf(this.uint8a,this.position):this.position+=t.size,e}writeStruct(t,e){this.resize(this.position+t.size);const n=Object.assign(new t(this.uint8a,this.position),e);return this.position+=t.size,n}writeBytes(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length;s(t instanceof Uint8Array,"writeBytes must be passed an Uint8Array"),this.resize(this.position+(n-e));for(let r=e;r<n;r++)this.uint8a[this.position+r-e]=t[r];return this.position+=n-e,t}}class a{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0;this.iter=t,this.maxPosition=e}[Symbol.iterator](){return this}next(){return this.iter.stream.position>=this.maxPosition?{value:null,done:!0}:this.iter.next()}}const c=()=>{throw new Error("Not implemented")},u=(()=>{const t=new Uint16Array(1),e=new Uint8Array(t.buffer);return t[0]=43707,187===e[0]})();class l{constructor(t){let{size:e=0,sizeOf:n=()=>e,writeSizeOf:r=c,toBytes:i=new Uint8Array(1),read:s,write:o=c}=t;this.size=e,this.sizeOf=n,this.writeSizeOf=r,this.toBytes=i,this.bytes=new Uint8Array(i.buffer),this.read=s,this.write=o}asPropertyObject(t){const e=this;return{get(){return e.read(this.uint8a,t+this.offset)},set(n){return e.write(this.uint8a,t+this.offset,n)},enumerable:!0}}read(){return null}}const h=new l({size:1,read:(t,e)=>t[e],write:(t,e,n)=>(t[e]=n,n)}),d={size:2,read(t,e){return this.bytes[1]=t[e+0],this.bytes[0]=t[e+1],this.toBytes[0]},write(t,e,n){return this.toBytes[0]=n,t[e+0]=this.bytes[1],t[e+1]=this.bytes[0],n}},p={size:2,read(t,e){return this.bytes[0]=t[e+0],this.bytes[1]=t[e+1],this.toBytes[0]},write(t,e,n){return this.toBytes[0]=n,t[e+0]=this.bytes[0],t[e+1]=this.bytes[1],n}};let f;f=u?d:p;new l(Object.assign({},f,{toBytes:new Uint16Array(1)}));const m=new l(Object.assign({},f,{toBytes:new Int16Array(1)})),g={size:4,read(t,e){return this.bytes[3]=t[e+0],this.bytes[2]=t[e+1],this.bytes[1]=t[e+2],this.bytes[0]=t[e+3],this.toBytes[0]},write(t,e,n){return this.toBytes[0]=n,t[e+0]=this.bytes[3],t[e+1]=this.bytes[2],t[e+2]=this.bytes[1],t[e+3]=this.bytes[0],n}},b={size:4,read(t,e){return this.bytes[0]=t[e+0],this.bytes[1]=t[e+1],this.bytes[2]=t[e+2],this.bytes[3]=t[e+3],this.toBytes[0]},write(t,e,n){return this.toBytes[0]=n,t[e+0]=this.bytes[0],t[e+1]=this.bytes[1],t[e+2]=this.bytes[2],t[e+3]=this.bytes[3],n}};let y;y=u?g:b;const v=new l(Object.assign({},y,{toBytes:new Int32Array(1)})),w=new l(Object.assign({},y,{toBytes:new Uint32Array(1)}));let T;T=u?p:d;const E=new l(Object.assign({},T,{toBytes:new Uint16Array(1)}));let A;A=u?b:g;const k=new l(Object.assign({},A,{toBytes:new Uint32Array(1)}));let I;I=u?{size:8,read(t,e){return this.bytes[7]=t[e+0],this.bytes[6]=t[e+1],this.bytes[5]=t[e+2],this.bytes[4]=t[e+3],this.bytes[3]=t[e+4],this.bytes[2]=t[e+5],this.bytes[1]=t[e+6],this.bytes[0]=t[e+7],this.toBytes[0]}}:{size:8,read(t,e){return this.bytes[7]=t[e+0],this.bytes[6]=t[e+1],this.bytes[5]=t[e+2],this.bytes[4]=t[e+3],this.bytes[3]=t[e+4],this.bytes[2]=t[e+5],this.bytes[1]=t[e+6],this.bytes[0]=t[e+7],this.toBytes[0]}};const S=new l(Object.assign({},I,{toBytes:new Float64Array(1)}));class x extends l{constructor(t){super({size:t,read(e,n){let r="";for(let i=0;i<t;i++){const t=e[n+i];s(t<=127,"Non-ascii character in FixedAsciiString"),r+=String.fromCharCode(t)}return r},write(e,n,r){for(let i=0;i<t;i++){const t=r.charCodeAt(i);s(t<=127,"Non-ascii character in FixedAsciiString"),e[n+i]=t}return r}})}}var O=n(18);const M=10485760;let N;N=new l(u?{size:3,read:(t,e)=>t[e+0]<<16|t[e+1]<<8|t[e+2]}:{size:3,read:(t,e)=>t[e+2]<<16|t[e+1]<<8|t[e+0]});const C=new l({sizeOf(t,e){const n=m.read(t,e);return m.size+n},read(t,e){let n=0,r=0;const i=m.read(t,e);for(let s=0;s<i;s++)n+=r*h.read(t,e++),r*=256;return n}}),R=new l({sizeOf(t,e){const n=w.read(t,e);return w.size+n},read(t,e){const n=w.read(t,e);s(n<M,"asciiString too big"),e+=4;let r="";for(let i=0;i<n;i++)r+=String.fromCharCode(t[e++]);return r}}),D=new l({sizeOf:(t,e)=>w.size+w.read(t,e),read(t,e){const n=w.read(t,e);return s(n<M,"bytes too big"),e+=w.size,s(n<M,"uint8a array too big"),new Uint8Array(t.buffer,e,n)}}),P=new l({sizeOf:(t,e)=>w.size+2*w.read(t,e),read(t,e){const n=w.read(t,e);s(n<M,"sound too big"),e+=w.size;const r=2*n;return s(r<M,"uint8a array too big"),new Uint8Array(t.buffer,e,r)}}),L=new l({sizeOf:(t,e)=>w.size+w.read(t,e)*w.size,read(t,e){const n=w.read(t,e);s(n<M,"bitmap too big"),e+=w.size,s(n<M,"uint8a array too big");const r=new Uint32Array(n);for(let i=0;i<n;i++)r[i]=w.read(t,e),e+=w.size;return r}});let B;B="undefined"==typeof TextDecoder?new O.TextDecoder:new TextDecoder;const U=new l({sizeOf:(t,e)=>w.size+w.read(t,e),read(t,e){const n=w.read(t,e);return s(n<M,"utf8 too big"),e+=w.size,s(n<M,"uint8a array too big"),B.decode(new Uint8Array(t.buffer,e,n))}}),j=new l({size:4,read(t,e){const n=w.read(t,e);return(255<<24|(n>>22&255)<<16|(n>>12&255)<<8|n>>2&255)>>>0}}),F=new l({size:5,read(t,e){const n=w.read(t,e);return(h.read(t,e)<<24|(n>>22&255)<<16|(n>>12&255)<<8|n>>2&255)>>>0}}),z={NULL:1,TRUE:2,FALSE:3,SMALL_INT:4,SMALL_INT_16:5,LARGE_INT_POSITIVE:6,LARGE_INT_NEGATIVE:7,FLOATING:8,STRING:9,SYMBOL:10,BYTES:11,SOUND:12,BITMAP:13,UTF8:14,ARRAY:20,ORDERED_COLLECTION:21,SET:22,IDENTITY_SET:23,DICTIONARY:24,IDENTITY_DICTIONARY:25,COLOR:30,TRANSLUCENT_COLOR:31,POINT:32,RECTANGLE:33,FORM:34,SQUEAK:35,OBJECT_REF:99,MORPH:100,ALIGNMENT:104,STATIC_STRING:105,UPDATING_STRING:106,SAMPLED_SOUND:109,IMAGE_MORPH:110,SPRITE:124,STAGE:125,WATCHER:155,IMAGE_MEDIA:162,SOUND_MEDIA:164,MULTILINE_STRING:171,WATCHER_READOUT_FRAME:173,WATCHER_SLIDER:174,LIST_WATCHER:175},V=Object.entries(z).reduce(((t,e)=>{let[n,r]=e;return t[r]=n,t}),{});class G{constructor(t,e){this.classId=t,this.position=e}}const Y=t=>"object"==typeof t&&t?t.valueOf():t;class H extends G{constructor(t,e,n){super(t,e),this.value=n}valueOf(){return this.value}toJSON(){return this.classId===z.TRANSLUCENT_COLOR||this.classId===z.COLOR?16777215&this.value:this.value}toString(){return this.value}}class W extends G{constructor(t,e,n){super(t,e),this.size=n}}class K extends G{constructor(t,e,n){super(t,e),this.index=n}valueOf(){return"Ref(".concat(this.index,")")}}class q extends W{constructor(t,e,n,r){super(t,e,r),this.version=n}}class Q{constructor(t){let{type:e=H,read:n,value:r=(n?t=>t.read(n):null)}=t;this.type=e,this.value=r}next(t,e,n){return{value:new this.type(e,n,this.value(t)),done:!1}}}const X={[z.NULL]:{value:()=>null},[z.TRUE]:{value:()=>!0},[z.FALSE]:{value:()=>!1},[z.SMALL_INT]:{read:v},[z.SMALL_INT_16]:{read:m},[z.LARGE_INT_POSITIVE]:{read:C},[z.LARGE_INT_NEGATIVE]:{read:C},[z.FLOATING]:{read:S},[z.STRING]:{read:R},[z.SYMBOL]:{read:R},[z.BYTES]:{read:D},[z.SOUND]:{read:P},[z.BITMAP]:{read:L},[z.UTF8]:{read:U},[z.ARRAY]:{type:W,read:v},[z.ORDERED_COLLECTION]:{type:W,read:v},[z.SET]:{type:W,read:v},[z.IDENTITY_SET]:{type:W,read:v},[z.DICTIONARY]:{type:W,value:t=>2*t.read(v)},[z.IDENTITY_DICTIONARY]:{type:W,value:t=>2*t.read(v)},[z.COLOR]:{read:j},[z.TRANSLUCENT_COLOR]:{read:F},[z.POINT]:{type:W,value:()=>2},[z.RECTANGLE]:{type:W,value:()=>4},[z.FORM]:{type:W,value:()=>5},[z.SQUEAK]:{type:W,value:()=>6},[z.OBJECT_REF]:{type:K,read:N}},Z=Array.from({length:256},((t,e)=>X[e]?new Q(X[e]):null)),J=new Q({type:class extends W{constructor(t,e){super(t,e,0)}},value:()=>null});class _{constructor(t,e){this.buffer=t,this.stream=new o(t,e)}[Symbol.iterator](){return this}next(){if(this.stream.position>=this.stream.uint8a.length)return{value:null,done:!0};const t=this.stream.position,e=this.stream.read(h),n=Z[e];if(null!==n)return n.next(this.stream,e,t);if(e<z.OBJECT_REF)return J.next(this.stream,e,t);const r=this.stream.read(h),i=this.stream.read(h);return{value:new q(e,t,r,i),done:!1}}}class ${constructor(t){let{classId:e,version:n,fields:r}=t;this.classId=e,this.version=n,this.fields=r}get FIELDS(){return[]}get RAW_FIELDS(){return this.fields}string(t){return String(this.fields[t])}number(t){return+this.fields[t]}boolean(t){return!!this.fields[t]}toString(){return this.constructor===$?"".concat(this.constructor.name," ").concat(this.classId," ").concat(V[this.classId]):this.constructor.name}static define(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$;class n extends e{get FIELDS(){return t}static get FIELDS(){return t}}return Object.keys(t).forEach((e=>{const r=t[e];Object.defineProperty(n.prototype,e.toLowerCase().replace(/_(\w)/g,(t=>{let[,e]=t;return e.toUpperCase()})),{get(){return this.fields[r]}})})),n}}class tt{constructor(){let t;this.bit=new Uint32Array(1),this.crc=0,this.c=0,this.table=[];for(let e=0;e<256;e++){t=e;for(let e=0;e<8;e++)t=1&t?3988292384^t>>>1:t>>>1;this.table[e]=t>>>0}}update(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,r=~this.crc>>>0;for(let i=0;i<n;i++)r=r>>>8^this.table[255&(r^t[e+i])];return this.crc=~r>>>0,this}get digest(){return this.crc}}const et=[0,4278190080,4294967295,4286611584,4294901760,4278255360,4278190335,4278255615,4294967040,4294902015,4280295456,4282400832,4284506208,4288651167,4290756543,4292861919,4278716424,4279242768,4279769112,4280821800,4281348144,4281874488,4282927176,4283453520,4283979864,4285032552,4285558896,4286085240,4287072135,4287598479,4288124823,4289177511,4289703855,4290230199,4291282887,4291809231,4292335575,4293388263,4293914607,4294440951,4278190080,4278203136,4278216192,4278229248,4278242304,4278255360,4278190131,4278203187,4278216243,4278229299,4278242355,4278255411,4278190182,4278203238,4278216294,4278229350,4278242406,4278255462,4278190233,4278203289,4278216345,4278229401,4278242457,4278255513,4278190284,4278203340,4278216396,4278229452,4278242508,4278255564,4278190335,4278203391,4278216447,4278229503,4278242559,4278255615,4281532416,4281545472,4281558528,4281571584,4281584640,4281597696,4281532467,4281545523,4281558579,4281571635,4281584691,4281597747,4281532518,4281545574,4281558630,4281571686,4281584742,4281597798,4281532569,4281545625,4281558681,4281571737,4281584793,4281597849,4281532620,4281545676,4281558732,4281571788,4281584844,4281597900,4281532671,4281545727,4281558783,4281571839,4281584895,4281597951,4284874752,4284887808,4284900864,4284913920,4284926976,4284940032,4284874803,4284887859,4284900915,4284913971,4284927027,4284940083,4284874854,4284887910,4284900966,4284914022,4284927078,4284940134,4284874905,4284887961,4284901017,4284914073,4284927129,4284940185,4284874956,4284888012,4284901068,4284914124,4284927180,4284940236,4284875007,4284888063,4284901119,4284914175,4284927231,4284940287,4288217088,4288230144,4288243200,4288256256,4288269312,4288282368,4288217139,4288230195,4288243251,4288256307,4288269363,4288282419,4288217190,4288230246,4288243302,4288256358,4288269414,4288282470,4288217241,4288230297,4288243353,4288256409,4288269465,4288282521,4288217292,4288230348,4288243404,4288256460,4288269516,4288282572,4288217343,4288230399,4288243455,4288256511,4288269567,4288282623,4291559424,4291572480,4291585536,4291598592,4291611648,4291624704,4291559475,4291572531,4291585587,4291598643,4291611699,4291624755,4291559526,4291572582,4291585638,4291598694,4291611750,4291624806,4291559577,4291572633,4291585689,4291598745,4291611801,4291624857,4291559628,4291572684,4291585740,4291598796,4291611852,4291624908,4291559679,4291572735,4291585791,4291598847,4291611903,4291624959,4294901760,4294914816,4294927872,4294940928,4294953984,4294967040,4294901811,4294914867,4294927923,4294940979,4294954035,4294967091,4294901862,4294914918,4294927974,4294941030,4294954086,4294967142,4294901913,4294914969,4294928025,4294941081,4294954137,4294967193,4294901964,4294915020,4294928076,4294941132,4294954188,4294967244,4294902015,4294915071,4294928127,4294941183,4294954239,4294967295],nt=[4294967295,4278190080],rt=new l({sizeOf(t,e){const n=t[e];return n<=223?1:n<=254?2:5},read(t,e){const n=t[e];return n<=223?n:n<=254?256*(n-224)+t[e+1]:w.read(t,e+1)}});class it{decode(t,e,n,r,i){const s=this.decodePixels(r,32===n);if(n<=8)return i||(i=1===n?nt:et),this.unpackPixels(s,t,e,n,i);if(16===n)return this.raster16To32(s,t,e);if(32===n)return s;throw new Error("Unhandled Squeak Image depth.")}decodePixels(t,e){let n;if(Array.isArray(t)||t instanceof Uint32Array){if(n=new Uint32Array(t),e)for(let t=0;t<n.length;t++)0!==n[t]&&(n[t]=4278190080|n[t]);return n}const r=new o(t.buffer,t.byteOffset),i=r.read(rt);n=new Uint32Array(i);let s=0;for(;s<i;){const t=r.read(rt),i=t>>2;let o;switch(3&t){case 0:s+=i;break;case 1:o=r.read(h),o|=o<<24|o<<16|o<<8,e&&0!==o&&(o|=4278190080);for(let t=0;t<i;t++)n[s++]=o;break;case 2:o=r.read(w),e&&0!==o&&(o|=4278190080);for(let t=0;t<i;t++)n[s++]=o;break;case 3:for(let t=0;t<i;t++)o=r.read(w),e&&0!==o&&(o|=4278190080),n[s++]=o}}return n}unpackPixels(t,e,n,r,i){const s=new Uint32Array(e*n),o=(1<<r)-1,a=32/r;let c=0,u=0;for(let l=0;l<n;l++){let n,l=-1;for(let h=0;h<e;h++)l<0&&(l=r*(a-1),n=t[u++]),s[c++]=i[n>>l&o],l-=r}return s}raster16To32(t,e,n){const r=new Uint32Array(2*t.length);let i,s,o,a=0,c=0;for(let u=0;u<n;u++){i=-1;for(let n=0;n<e;n++){if(i<0&&(i=16,s=t[a++]),o=s>>i&65535,0!==o){o=4278190080|(o>>7&248)<<16|(o>>2&248)<<8|o<<3&248}r[c++]=o,i-=16}}return r}buildCustomColormap(t,e,n){const r=new Uint32Array(1<<t);for(let t=0;t<e.length;t++)r[t]=n[e[t].index-1];return r}}const st=[7,8,9,10,11,12,13,14,16,17,19,21,23,25,28,31,34,37,41,45,50,55,60,66,73,80,88,97,107,118,130,143,157,173,190,209,230,253,279,307,337,371,408,449,494,544,598,658,724,796,876,963,1060,1166,1282,1411,1552,1707,1878,2066,2272,2499,2749,3024,3327,3660,4026,4428,4871,5358,5894,6484,7132,7845,8630,9493,10442,11487,12635,13899,15289,16818,18500,20350,22385,24623,27086,29794,32767],ot={2:[-1,2,-1,2],3:[-1,-1,2,4,-1,-1,2,4],4:[-1,-1,-1,-1,2,4,6,8,-1,-1,-1,-1,2,4,6,8],5:[-1,-1,-1,-1,-1,-1,-1,-1,1,2,4,6,8,10,13,16,-1,-1,-1,-1,-1,-1,-1,-1,1,2,4,6,8,10,13,16]};class at{constructor(t){this.bitsPerSample=t,this.indexTable=ot[t],this.signMask=1<<t-1,this.valueMask=this.signMask-1,this.valueHighBit=this.signMask>>1,this.bitPosition=0,this.currentByte=0,this.stream=null,this.end=0}decode(t){this.bitPosition=0,this.currentByte=0,this.stream=new o(t.buffer,t.byteOffset),this.end=t.byteOffset+t.length;const e=Math.floor(8*t.length/this.bitsPerSample),n=new Int16Array(e);let r=0,i=0;for(let t=0;t<e;t++){const e=this.nextCode();s(e>=0,"Ran out of bits in Squeak Sound");let o=st[i],a=0;for(let t=this.valueHighBit;t>0;t>>=1)e&t&&(a+=o),o>>=1;a+=o,r+=e&this.signMask?-a:a,i+=this.indexTable[e],i<0&&(i=0),i>88&&(i=88),r>32767&&(r=32767),r<-32768&&(r=-32768),n[t]=r}return n}nextCode(){let t=this.bitsPerSample,e=t-this.bitPosition,n=e<0?this.currentByte>>-e:this.currentByte<<e;for(;e>0;){if(t-=this.bitPosition,!(this.end-this.stream.position>0))return this.currentByte=0,this.bitPosition=0,-1;this.currentByte=this.stream.read(h),this.bitPosition=8,e=t-this.bitPosition,n+=e<0?this.currentByte>>-e:this.currentByte<<e}return this.bitPosition-=t,this.currentByte=this.currentByte&255>>8-this.bitPosition,n}static samples(t,e){return 8*e.length/t}}class ct{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array(this.size),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.uint8a=t,this.offset=e}equals(t){for(const e in t)if(this[e]!==t[e])return!1;return!0}view(){const t=this.constructor.name,e={toString:()=>t};for(const t in this.shape)e[t]=this[t];return e}static initConstructor(t){return t.size=t.prototype.size,t}static extend(t){const e=class extends ct{get shape(){return t}};let n=0;return Object.keys(t).forEach((r=>{if(Object.defineProperty(e.prototype,r,t[r].asPropertyObject(n)),0===t[r].size)throw new Error("Packet cannot be defined with variable sized members.");n+=t[r].size})),e.prototype.size=n,e.size=n,e}}class ut extends(ct.extend({riff:new x(4),length:k,wave:new x(4)})){}ct.initConstructor(ut);class lt extends(ct.extend({chunkType:new x(4),length:k})){}ct.initConstructor(lt);class ht extends(ct.extend({format:E,channels:E,sampleRate:k,bytesPerSec:k,blockAlignment:E,bitsPerSample:E})){}ct.initConstructor(ht);class dt{encode(t){let{channels:e=1,sampleRate:n=22050}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),i=ut.size+lt.size+ht.size+lt.size+r.length,s=new o(new ArrayBuffer(i));return s.writeStruct(ut,{riff:"RIFF",length:i-8,wave:"WAVE"}),s.writeStruct(lt,{chunkType:"fmt ",length:ht.size}),s.writeStruct(ht,{format:1,channels:e,sampleRate:n,bytesPerSec:2*n*e,blockAlignment:2*e,bitsPerSample:16}),s.writeStruct(lt,{chunkType:"data",length:i-s.position-lt.size}),s.writeBytes(r),s.uint8a}static encode(t,e){return(new dt).encode(t,e)}static samples(t){const e=new lt(t,ut.size).length;return new lt(t,ut.size+lt.size+e).length/2}}var pt=n(34),ft=n.n(pt);class mt extends($.define({X:0,Y:1})){}class gt extends($.define({X:0,Y:1,X2:2,Y2:3})){get width(){return this.x2-this.x}get height(){return this.y2-this.y}}class bt extends($.define({WIDTH:0,HEIGHT:1,DEPTH:2,BYTES:4,COLORMAP:5})){get decoded(){return this._decoded||(this._decoded=(t=>{for(let e=0;e<t.length;e+=4){const n=t[e+2],r=t[e+0];t[e+2]=r,t[e+0]=n}return t})(new Uint8Array((new it).decode(this.width.value,this.height.value,this.depth.value,this.bytes.value,this.colormap&&this.colormap.map((t=>t.valueOf()))).buffer))),this._decoded}get extension(){return"uncompressed"}}class yt extends($.define({STAGE_CONTENTS:2,OBJ_NAME:6,VARS:7,BLOCKS_BIN:8,IS_CLONE:9,MEDIA:10,CURRENT_COSTUME:11,ZOOM:12,H_PAN:13,V_PAN:14,OBSOLETE_SAVED_STATE:15,SPRITE_ORDER_IN_LIBRARY:16,VOLUME:17,TEMPO_BPM:18,SCENE_STATES:19,LISTS:20})){get spriteOrderInLibrary(){return this.fields[this.FIELDS.SPRITE_ORDER_IN_LIBRARY]||null}get tempoBPM(){return this.fields[this.FIELDS.TEMPO_BPM]||0}get lists(){return this.fields[this.FIELDS.LISTS]||[]}}class vt extends($.define({BOX:0,PARENT:1,COLOR:3,VISIBLE:4,OBJ_NAME:6,VARS:7,BLOCKS_BIN:8,IS_CLONE:9,MEDIA:10,CURRENT_COSTUME:11,VISIBILITY:12,SCALE_POINT:13,ROTATION_DEGREES:14,ROTATION_STYLE:15,VOLUME:16,TEMPO_BPM:17,DRAGGABLE:18,SCENE_STATES:19,LISTS:20})){get scratchX(){return this.box.x+this.currentCostume.rotationCenter.x-240}get scratchY(){return 180-(this.box.y+this.currentCostume.rotationCenter.y)}get visible(){return!(1&this.fields[this.FIELDS.VISIBLE])}get tempoBPM(){return this.fields[this.FIELDS.TEMPO_BPM]||0}get lists(){return this.fields[this.FIELDS.LISTS]||[]}}$.define({RECTANGLE:0,FONT:8,COLOR:9,LINES:11});class wt extends($.define({COSTUME_NAME:0,BITMAP:1,ROTATION_CENTER:2,TEXT_DETAILS:3,BASE_LAYER_DATA:4,OLD_COMPOSITE:5})){get image(){return this.oldComposite instanceof bt?this.oldComposite:this.baseLayerData.value?null:this.bitmap}get width(){return null===this.image?-1:this.image.width}get height(){return null===this.image?-1:this.image.height}get rawBytes(){return null===this.image?this.baseLayerData.value.slice():this.image.bytes.value}get decoded(){return null===this.image?this.baseLayerData.value.slice():this.image.decoded}get crc(){if(!this._crc){const t=(new tt).update(new Uint8Array(new Uint32Array([this.bitmap.width]).buffer)).update(new Uint8Array(new Uint32Array([this.bitmap.height]).buffer)).update(new Uint8Array(new Uint32Array([this.bitmap.depth]).buffer)).update(this.rawBytes);this._crc=t.digest}return this._crc}get extension(){return this.oldComposite instanceof bt?"uncompressed":this.baseLayerData.value?"jpg":"uncompressed"}toString(){return'ImageMediaData "'.concat(this.costumeName,'"')}}class Tt extends($.define({DATA:3,RATE:4})){}class Et extends($.define({NAME:0,UNCOMPRESSED:1,RATE:4,BITS_PER_SAMPLE:5,DATA:6})){get rate(){return 0!==this.uncompressed.data.value.length?this.uncompressed.rate:this.fields[this.FIELDS.RATE]}get rawBytes(){return this.data&&this.data.value?this.data.value:this.uncompressed.data.value}get decoded(){return this._decoded||(this.data&&this.data.value?this._decoded=new at(this.bitsPerSample.value).decode(this.data.value):this._decoded=new Int16Array((t=>{const e=new Uint8Array(t);for(let n=0;n<e.length;n+=2)e[n]=t[n+1],e[n+1]=t[n];return e})(this.uncompressed.data.value.slice()).buffer)),this._decoded}get crc(){return this._crc||(this._crc=(new tt).update(new Uint32Array([this.rate])).update(this.rawBytes).digest),this._crc}get sampleCount(){return this.data&&this.data.value?at.samples(this.bitsPerSample.value,this.data.value):this.uncompressed.data.value.length/2}get extension(){return"pcm"}get wavEncodedData(){return this._wavEncodedData||(this._wavEncodedData=new Uint8Array(dt.encode(this.decoded,{sampleRate:this.rate&&this.rate.value}))),this._wavEncodedData}get md5(){return this._md5||(this._md5=ft()(this.wavEncodedData)),this._md5}toString(){return'SoundMediaData "'.concat(this.name,'"')}}class At extends($.define({BOX:0,HIDDEN_WHEN_NULL:1,LIST_NAME:8,CONTENTS:9,TARGET:10})){get x(){return null===Y(this.hiddenWhenNull)?5:this.box.x+1}get y(){return null===Y(this.hiddenWhenNull)?5:this.box.y+1}get width(){return this.box.width-2}get height(){return this.box.height-2}}class kt extends($.define({BOX:0,PARENT:1,FRAMES:2,COLOR:3,DIRECTION:8,ALIGNMENT:9})){}class It extends($.define({BOX:0,PARENT:1,COLOR:3})){}class St extends($.define({BOX:0,COLOR:3,VALUE:8})){}class xt extends($.define({BOX:0,READOUT_FRAME:1,COLOR:3,FONT:6,VALUE:8,TARGET:10,CMD:11,PARAM:13})){}class Ot extends($.define({BOX:0})){}const Mt=1,Nt=2,Ct=3;class Rt extends($.define({BOX:0,TARGET:1,SHAPE:2,READOUT:14,READOUT_FRAME:15,SLIDER:16,ALIGNMENT:17,SLIDER_MIN:20,SLIDER_MAX:21})){get x(){return this.box.x}get y(){return this.box.y}get mode(){return null===Y(this.slider)?this.readoutFrame.box.height<=14?Mt:Nt:Ct}get isDiscrete(){return Math.floor(this.sliderMin)===this.sliderMin&&Math.floor(this.sliderMax)===this.sliderMax&&Math.floor(this.readout.value)===this.readout.value}}const Dt={[z.POINT]:mt,[z.RECTANGLE]:gt,[z.FORM]:bt,[z.SQUEAK]:bt,[z.SAMPLED_SOUND]:Tt,[z.SPRITE]:vt,[z.STAGE]:yt,[z.IMAGE_MEDIA]:wt,[z.SOUND_MEDIA]:Et,[z.ALIGNMENT]:kt,[z.MORPH]:It,[z.WATCHER_READOUT_FRAME]:Ot,[z.STATIC_STRING]:St,[z.UPDATING_STRING]:xt,[z.WATCHER]:Rt,[z.LIST_WATCHER]:At},Pt=Array.from({length:256},((t,e)=>Dt[e]||null));class Lt{constructor(t){this.valueIterator=t}[Symbol.iterator](){return this}next(){const t=this.valueIterator.next();if(t.done)return t;const e=t.value,{classId:n}=e;let r=e;if(e instanceof W){r=[];for(let t=0;t<e.size;t++)r.push(this.next().value)}if(null!==Pt[n]||e instanceof q){r=new(Pt[e.classId]||$)({classId:e.classId,version:e.version,fields:r})}return{value:r,done:!1}}}class Bt{constructor(t){this.table=Array.from(t),this.fixed=this.fix(this.table)}fix(){const t=[];for(let e=0;e<this.table.length;e++)this.fixItem(this.table[e]),t.push(this.table[e]);return t}fixItem(t){if(void 0!==t.fields&&(t=t.fields),Array.isArray(t))for(let e=0;e<t.length;e++)t[e]=this.deref(t[e])}deref(t){return t instanceof K?this.table[t.index-1]:t}}class Ut extends(ct.extend({support8Bit:h,png:new x(3),dosLineEnding:new x(2),dosEndOfFile:new x(1),unixLineEnding:new x(1)})){static validate(){s(this.equals({support8Bit:137,png:"PNG",dosLineEnding:"\r\n",dosEndOfFile:"",unixLineEnding:"\n"}),"PNGSignature does not match the expected values")}}ct.initConstructor(Ut);class jt extends(ct.extend({length:w,chunkType:new x(4)})){}ct.initConstructor(jt);class Ft extends(ct.extend({checksum:w})){}ct.initConstructor(Ft);class zt extends(ct.extend({width:w,height:w,bitDepth:h,colorType:h,compressionMethod:h,filterMethod:h,interlaceMethod:h})){}ct.initConstructor(zt);class Vt extends(ct.extend({method:h})){}ct.initConstructor(Vt);class Gt{constructor(){this.adler=1}update(t,e,n){let r=65535&this.adler,i=this.adler>>>16;for(let s=0;s<n;s++)r=(r+t[e+s])%65521,i=(i+r)%65521;return this.adler=i<<16|r,this}get digest(){return this.adler}}const Yt=65535;class Ht extends(ct.extend({cmf:h,flag:h})){}ct.initConstructor(Ht);class Wt extends(ct.extend({lastPacket:h,length:E,lengthCheck:E})){}ct.initConstructor(Wt);class Kt extends(ct.extend({checksum:k})){}ct.initConstructor(Kt);class qt{constructor(t){this.stream=t}get uint8a(){return this.stream.uint8a}set uint8a(t){return this.stream.uint8a=t,this.stream.uint8a}get position(){return this.stream.position}set position(t){return this.stream.position=t,this.stream.position}writeStruct(t,e){return this.stream.writeStruct(t,e)}writeBytes(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length;return this.stream.writeBytes(t,e,n)}}class Qt extends qt{constructor(t){super(t),this.stream.writeStruct(Ht,{cmf:8,flag:29}),this.adler=new Gt,this.chunk=this.stream.writeStruct(Wt,{lastPacket:0,length:0,lengthCheck:65535})}get _deflateIndex(){return this.chunk.length}set _deflateIndex(t){return this.chunk.length=t,this.chunk.lengthCheck=65535^t,this.chunk.length}writeStruct(t,e){this.writeBytes(Object.assign(new t,e).uint8a)}writeBytes(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,r=e;for(;n-r>0;){this._deflateIndex===Yt&&(this.chunk=this.stream.writeStruct(Wt,{lastPacket:0,length:0,lengthCheck:65535}));const e=Math.min(n-r,Yt-this._deflateIndex);this.stream.writeBytes(t,r,r+e),this._deflateIndex+=e,r+=e}this.adler.update(t,e,n-e)}finish(){this.chunk.lastPacket=1,this.stream.writeStruct(Kt,{checksum:this.adler.digest})}static estimateSize(t){const e=Math.ceil(t/Yt);return Ht.size+e*Wt.size+Kt.size+t}}class Xt extends qt{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"IHDR";super(t),this.start=this.stream.writeStruct(jt,{length:0,chunkType:e}),this.crc=new tt}finish(){const t=this.start.offset+this.start.size,e=this.position-t;this.start.length=e,this.crc.update(this.stream.uint8a,t-w.size,e+w.size),this.stream.writeStruct(Ft,{checksum:this.crc.digest})}static size(t){return jt.size+t+Ft.size}}class Zt{encode(t,e,n){const r=4*t+Vt.size,i=r*e,s=Ut.size+Xt.size(zt.size)+Xt.size(Qt.estimateSize(i))+Xt.size(0),a=new o(new ArrayBuffer(s));a.writeStruct(Ut,{support8Bit:137,png:"PNG",dosLineEnding:"\r\n",dosEndOfFile:"",unixLineEnding:"\n"});const c=new Xt(a,"IHDR");c.writeStruct(zt,{width:t,height:e,bitDepth:8,colorType:6,compressionMethod:0,filterMethod:0,interlaceMethod:0}),c.finish();const u=new Xt(a,"IDAT"),l=new Qt(u);let h=0;for(;h<n.length;){l.writeStruct(Vt,{method:0});const t=Math.min(n.length-h,r-Vt.size);l.writeBytes(n,h,h+t),h+=t}l.finish(),u.finish();return new Xt(a,"IEND").finish(),a.buffer}static encode(t,e,n){return(new Zt).encode(t,e,n)}}class Jt{constructor(t){this.file=t}async(t){return s("uint8array"===t,"SB1FakeZipFile only supports uint8array"),Promise.resolve(this.file.bytes)}}class _t{constructor(t){this.files=t}file(t){if(t in this.files)return new Jt(this.files[t])}}const $t=t=>"uncompressed"===t.extension?new Uint8Array(Zt.encode(t.width,t.height,t.decoded)):t.decoded,te=t=>{const e=String(t[t.length-1]),n=t.length-1;return"mouse"===e?t[n]="_mouse_":"edge"===e?t[n]="_edge_":t[t.length-1]instanceof yt&&(t[n]="_stage_"),t},ee={getParam:t=>{let[e,n,r,i]=t;return[e,n,r,i||"r"]},changeVariable:t=>[t[2],t[1],t[3]],EventHatMorph:t=>"Scratch-StartClicked"===String(t[1])?["whenGreenFlag"]:["whenIReceive",t[1]],MouseClickEventHatMorph:()=>["whenClicked"],KeyEventHatMorph:t=>["whenKeyPressed",t[1]],stopScripts:t=>"other scripts"===String(t[1])?[t[0],"other scripts in sprite"]:t,abs:t=>["computeFunction:of:","abs",t[1]],sqrt:t=>["computeFunction:of:","sqrt",t[1]],"\\\\":t=>["%",...t.slice(1)],doReturn:()=>["stopScripts","this script"],stopAll:()=>["stopScripts","all"],"showBackground:":t=>["startScene",t[1]],nextBackground:()=>["nextScene"],doForeverIf:t=>["doForever",[["doIf",t[1],t[2]]]],"getAttribute:of:":te,"gotoSpriteOrMouse:":te,"distanceTo:":te,"pointTowards:":te,"touching:":te},ne=t=>{const{info:e,stageData:n,images:r,sounds:i}=t,s=t=>{const e=[];for(let n=0;n<t.length;n+=2)e.push([t[n],t[n+1]]);return e},o=t=>{let[e,n]=t;return{name:e,value:n,isPersistent:!1}},a=t=>{let[,{listName:e,contents:n,x:r,y:i,width:s,height:o,hiddenWhenNull:a}]=t;return{listName:e,contents:n,isPersistent:!1,x:r,y:i,width:s,height:o,visible:null!==(c=a,"object"==typeof c&&c?c.valueOf():c)};var c},c=t=>{const e=i.findIndex((e=>e.crc===t.crc));return{soundName:t.name,soundID:e,md5:"".concat(t.md5,".wav"),sampleCount:t.sampleCount,rate:t.rate,format:""}},u=t=>{const e=r.findIndex((e=>e.crc===t.crc));return{costumeName:t.costumeName,baseLayerID:e,baseLayerMD5:"".concat(ft()(t.rawBytes),".").concat((n=t,"uncompressed"===n.extension?"png":"jpg")),bitmapResolution:1,rotationCenterX:t.rotationCenter.x,rotationCenterY:t.rotationCenter.y};var n},l=t=>{let e=t.map(d);const n=ee[e[0]];return n&&(e=n(e)),e},h=t=>t.map(l),d=t=>t instanceof vt?t.objName:Array.isArray(t)?0===t.length||Array.isArray(t[0])?h(t):l(t):t,p=t=>[t[0].x,t[0].y,h(t[1])],f=t=>t instanceof vt?(t=>{const e=t.media.filter((t=>t instanceof wt)),r=t.media.filter((t=>t instanceof Et));return{objName:t.objName,variables:s(t.vars).map(o),lists:s(t.lists).map(a),scripts:t.blocksBin.map(p),costumes:e.map(u),currentCostumeIndex:e.findIndex((e=>e.crc===t.currentCostume.crc)),sounds:r.map(c),scratchX:t.scratchX,scratchY:t.scratchY,scale:t.scalePoint.x,direction:Math.round(1e6*t.rotationDegrees)/1e6-270,rotationStyle:t.rotationStyle,isDraggable:t.draggable,indexInLibrary:n.spriteOrderInLibrary.indexOf(t),visible:t.visible,spriteInfo:{}}})(t):null;return JSON.parse(JSON.stringify(Object.assign((t=>{const e=t.media.filter((t=>t instanceof wt)),n=t.media.filter((t=>t instanceof Et));return{objName:t.objName,variables:s(t.vars).map(o),lists:s(t.lists).map(a),scripts:t.blocksBin.map(p),costumes:e.map(u),currentCostumeIndex:e.findIndex((e=>e.crc===t.currentCostume.crc)),sounds:n.map(c),penLayerMD5:"5c81a336fab8be57adc039a8a2b33ca9.png",penLayerID:0,tempoBPM:t.tempoBPM,videoAlpha:.5,children:t.stageContents.map(f).filter(Boolean).reverse()}})(n),{info:(t=>{const e={};for(let n=0;n<t.length;n+=2)"thumbnail"!==String(t[n])&&(e[String(t[n])]=String(t[n+1]));return e})(e)})))};class re extends(ct.extend({version:new x(10),infoByteLength:w})){validate(){s.validate(this.equals({version:"ScratchV01"})||this.equals({version:"ScratchV02"}),"Invalid Scratch file signature.")}}ct.initConstructor(re);class ie extends(ct.extend({ObjS:new x(4),ObjSValue:h,Stch:new x(4),StchValue:h,numObjects:w})){validate(){s.validate(this.equals({ObjS:"ObjS",ObjSValue:1,Stch:"Stch",StchValue:1}),"Invalid Scratch file info packet header.")}}ct.initConstructor(ie);class se{constructor(t){this.buffer=t,this.stream=new o(t),this.signature=this.stream.readStruct(re),this.signature.validate(),this.infoHeader=this.stream.readStruct(ie),this.infoHeader.validate(),this.stream.position+=this.signature.infoByteLength-ie.size,this.dataHeader=this.stream.readStruct(ie),this.dataHeader.validate()}get json(){return ne({info:this.info(),stageData:this.data(),images:this.images(),sounds:this.sounds()})}get zip(){return(t=>{let{images:e,sounds:n}=t;const r={};let i=0;for(const t of e)r["".concat(i++,".").concat((s=t,"uncompressed"===s.extension?"png":"jpg"))]={bytes:$t(t)};var s,o;i=0;for(const t of n)r["".concat(i++,".wav")]={bytes:(o=t,o.wavEncodedData)};return new _t(r)})({images:this.images(),sounds:this.sounds()})}view(){return{signature:this.signature,infoHeader:this.infoHeader,dataHeader:this.dataHeader,toString:()=>"SB1File"}}infoRaw(){return new a(new _(this.buffer,this.infoHeader.offset+ie.size),this.signature.infoByteLength+re.size)}infoTable(){return new Lt(this.infoRaw())}info(){return this._info||(this._info=new Bt(this.infoTable()).table[0]),this._info}dataRaw(){return new a(new _(this.buffer,this.dataHeader.offset+ie.size),this.stream.uint8a.length)}dataTable(){return new Lt(this.dataRaw())}dataFixed(){return this._data||(this._data=new Bt(this.dataTable()).table),this._data}data(){return this.dataFixed()[0]}images(){const t=new Set;return this.dataFixed().filter((e=>e instanceof wt&&(!t.has(e.crc)&&(t.add(e.crc),!0))))}sounds(){const t=new Set;return this.dataFixed().filter((e=>e instanceof Et&&(!t.has(e.crc)&&(t.add(e.crc),!0))))}}},function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"Scaffolding",(function(){return G})),n.d(r,"Cloud",(function(){return E})),n.d(r,"VM",(function(){return a.a})),n.d(r,"Renderer",(function(){return u.a})),n.d(r,"Storage",(function(){return g})),n.d(r,"AudioEngine",(function(){return p.a})),n.d(r,"JSZip",(function(){return s.a}));var i=n(19),s=n.n(i),o=n(52),a=n.n(o),c=n(83),u=n.n(c),l=n(89),h=n.n(l),d=n(90),p=n.n(d),f=n(23);class m extends h.a{constructor(){super(),this._totalAssets=0,this._loadedAssets=0}_updateProgress(){this.onprogress&&this.onprogress(this._totalAssets,this._loadedAssets)}load(t,e,n){return t===this.AssetType.ImageBitmap||t===this.AssetType.ImageVector||t===this.AssetType.Sound||t===this.AssetType.Font?(this._totalAssets++,this._updateProgress(),super.load(t,e,n).then((t=>(this._loadedAssets++,this._updateProgress(),t)))):super.load(t,e,n)}}var g=m;class b{constructor(){this._events={}}addEventListener(t,e){this._events[t]||(this._events[t]=[]),this._events[t].push(e)}removeEventListener(t,e){const n=this._events[t];n&&(this._events[t]=n.filter((t=>t!==e)))}dispatchEvent(t){const e=this._events[t.type];if(e)for(const n of e)n(t)}}const y=[],v=t=>{let e;var n;return 0===y.length?(n={audio:!1,video:t},e=navigator.mediaDevices?navigator.mediaDevices.getUserMedia(n):Promise.reject(new Error("video is not supported in this context (insecure domain?)")),y.push(e)):y.length>0&&(e=y[0],y.push(!0)),e};class w{constructor(){this.mirror=!0,this._frameCacheTimeout=16,this._video=null,this._track=null,this._workspace=[]}static get FORMAT_IMAGE_DATA(){return"image-data"}static get FORMAT_CANVAS(){return"canvas"}static get DIMENSIONS(){return[480,360]}static get ORDER(){return 1}get video(){return this._video}enableVideo(){return this.enabled=!0,this._setupVideo()}disableVideo(){this.enabled=!1,this._singleSetup&&this._singleSetup.then(this._teardown.bind(this)).catch((t=>this.onError(t)))}_teardown(){if(!1===this.enabled){const t=(y.pop(),!(y.length>0));this._singleSetup=null,this._video=null,this._track&&t&&this._track.stop(),this._track=null}}getFrame(t){let{dimensions:e=w.DIMENSIONS,mirror:n=this.mirror,format:r=w.FORMAT_IMAGE_DATA,cacheTimeout:i=this._frameCacheTimeout}=t;if(!this.videoReady)return null;const[s,o]=e,a=this._getWorkspace({dimensions:e,mirror:Boolean(n)}),{videoWidth:c,videoHeight:u}=this._video,{canvas:l,context:h,lastUpdate:d,cacheData:p}=a,f=Date.now();d+i<f&&(n&&(h.scale(-1,1),h.translate(-1*s,0)),h.drawImage(this._video,0,0,c,u,0,0,s,o),h.setTransform(1,0,0,1,0,0),a.lastUpdate=f),p[r]||(p[r]={lastUpdate:0});const m=p[r];return m.lastUpdate+i<f&&(r===w.FORMAT_IMAGE_DATA?m.lastData=h.getImageData(0,0,s,o):r===w.FORMAT_CANVAS?(m.lastUpdate=1/0,m.lastData=l):(console.error("video io error - unimplemented format ".concat(r)),m.lastUpdate=1/0,m.lastData=null),m.lastUpdate=Math.max(a.lastUpdate,m.lastUpdate)),m.lastData}onError(t){console.error("Unhandled video io device error",t)}_setupVideo(){return this._singleSetup||(this._singleSetup=v({width:{min:480,ideal:640},height:{min:360,ideal:480}}).then((t=>{this._video=document.createElement("video");try{this._video.srcObject=t}catch(e){this._video.src=window.URL.createObjectURL(t)}return this._video.play(),this._track=t.getTracks()[0],this})).catch((t=>{this._singleSetup=null,this.onError(t)}))),this._singleSetup}get videoReady(){if(!this.enabled)return!1;if(!this._video)return!1;if(!this._track)return!1;const{videoWidth:t,videoHeight:e}=this._video;return"number"==typeof t&&"number"==typeof e&&(0!==t&&0!==e)}_getWorkspace(t){let{dimensions:e,mirror:n}=t,r=this._workspace.find((t=>t.dimensions.join("-")===e.join("-")&&t.mirror===n));return r||(r={dimensions:e,mirror:n,canvas:document.createElement("canvas"),lastUpdate:0,cacheData:{}},r.canvas.width=e[0],r.canvas.height=e[1],r.context=r.canvas.getContext("2d"),this._workspace.push(r)),r}}var T=w;var E={CloudManager:class{constructor(t){this.parent=t,this.providers=[],this.overrides=new Map}hasCloudData(){return this.parent.vm.runtime.hasCloudData()}projectReady(){if(this.hasCloudData())for(const t of this.providers)t.enable()}setVariable(t,e,n){this.overrides.has(e)&&this.overrides.get(e)!==t||this.parent.vm.postIOData("cloud",{varUpdate:{name:e,value:n}})}getUsername(){return this.parent._username}addProvider(t){t.manager=this,this.hasCloudData()&&t.enable(),this.providers.push(t)}requestCloseConnection(){}createVariable(t,e){}renameVariable(t,e){}deleteVariable(t){}addProviderOverride(t,e){if(e&&!this.providers.includes(e))throw new Error("Manager is not aware of this provider");this.overrides.set(t,e)}updateVariable(t,e){if(this.overrides.has(t)){const n=this.overrides.get(t);n&&n.handleUpdateVariable(t,e)}else for(const n of this.providers)n.handleUpdateVariable(t,e)}},WebSocketProvider:class{constructor(t,e){this.cloudHosts=Array.isArray(t)?t:[t],this.projectId=e,this.attemptedConnections=0,this.bufferedMessages=[],this.scheduledBufferedSend=null,this.reconnectTimeout=null,this.openConnection=this.openConnection.bind(this),this._scheduledSendBufferedMessages=this._scheduledSendBufferedMessages.bind(this)}enable(){this.openConnection()}setProjectId(t){this.projectId=t,this.closeAndReconnect()}openConnection(){this.projectId||console.warn("Project ID is empty. Cloud variable connection is unlikely to work."),this.currentCloudHost=this.cloudHosts[this.attemptedConnections%this.cloudHosts.length],this.attemptedConnections++,console.log("Connecting to ".concat(this.currentCloudHost," with ID ").concat(this.projectId,", username ").concat(this.manager.getUsername()));try{this.ws=new WebSocket(this.currentCloudHost)}catch(t){throw console.error(t),new Error("Cloud host ".concat(this.currentCloudHost," is invalid: ").concat(t))}this.ws.onerror=this.onerror.bind(this),this.ws.onmessage=this.onmessage.bind(this),this.ws.onopen=this.onopen.bind(this),this.ws.onclose=this.onclose.bind(this)}onerror(t){console.error("WebSocket error",t)}onmessage(t){for(const e of t.data.split("\n"))if(e){const t=JSON.parse(e);"set"===t.method&&this.manager.setVariable(this,t.name,t.value)}}onopen(){this.attemptedConnections=0,this.writeToServer({method:"handshake"}),this.sendBufferedMessages(),console.log("WebSocket connected")}onclose(t){if(t&&4002===t.code)return void console.log("Username is invalid; not reconnecting.");if(t&&4003===t.code)return void console.log("Cloud variable server is full; not reconnecting.");if(t&&4004===t.code)return void console.log("Project is blocked; not reconnecting.");const e=Math.random()*(Math.pow(2,Math.min(this.attemptedConnections+1,5))-1)*1e3;console.log("Connection lost; reconnecting in ".concat(Math.round(e),"ms")),this.reconnectTimeout=setTimeout(this.openConnection,e)}closeAndReconnect(){console.log("Closing connection and reconnecting."),this.ws&&(this.ws.onclose=null,this.ws.onerror=null,this.ws.close()),clearTimeout(this.reconnectTimeout);this.reconnectTimeout=setTimeout(this.openConnection,1e3/30)}canWriteToServer(){return this.ws&&this.ws.readyState===WebSocket.OPEN}scheduleBufferedSend(){this.scheduledBufferedSend||(this.scheduledBufferedSend=!0,Promise.resolve().then(this._scheduledSendBufferedMessages))}_scheduledSendBufferedMessages(){this.scheduledBufferedSend=!1,this.canWriteToServer()&&this.sendBufferedMessages()}sendBufferedMessages(){for(const t of this.bufferedMessages)this.writeToServer(t);this.bufferedMessages.length=0}bufferedWriteToServer(t){this.bufferedMessages.push(t),this.scheduleBufferedSend()}writeToServer(t){t.project_id=this.projectId,t.user=this.manager.getUsername(),this.ws.send(JSON.stringify(t))}handleUpdateVariable(t,e){for(const n of this.bufferedMessages)if(n.name===t)return void(n.value=e);this.bufferedWriteToServer({method:"set",name:t,value:e})}},LocalStorageProvider:class{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"p4:cloudvariables";this.key=t,this.variables={},this.handleStorageEvent=this.handleStorageEvent.bind(this)}readFromLocalStorage(){let t;try{if(t=JSON.parse(localStorage.getItem(this.key)),!t||"object"!=typeof t)return}catch(t){return}this.variables=t;for(const t of Object.keys(this.variables))this.manager.setVariable(this,t,this.variables[t])}storeToLocalStorage(){try{localStorage.setItem(this.key,JSON.stringify(this.variables))}catch(t){}}handleStorageEvent(t){t.key===this.key&&t.storageArea===localStorage&&this.readFromLocalStorage()}enable(){this.readFromLocalStorage(),window.addEventListener("storage",this.handleStorageEvent)}handleUpdateVariable(t,e){this.variables[t]=e,this.storeToLocalStorage()}}},A=n(92),k=n.n(A),I=n(51),S={insert:t=>{var e=document.head||document.body||document.documentElement;e.insertBefore(t,e.firstChild)},singleton:!1},x=(k()(I.a,S),I.a.locals||{});const O=t=>new Promise(((e,n)=>{const r=new FileReader;r.onload=()=>e(r.result),r.onerror=()=>n(new Error("Cannot read as text: ".concat(r.error))),r.readAsText(t)}));var M=class{constructor(t,e){this.el=t,this.callback=e,this.el.addEventListener("dragover",this.ondragover.bind(this)),this.el.addEventListener("dragleave",this.ondragleave.bind(this)),this.el.addEventListener("drop",this.ondrop.bind(this))}ondragover(t){t.dataTransfer.types.includes("Files")&&(t.preventDefault(),t.dataTransfer.dropEffect="copy",this.el.classList.add(x.dropping))}ondragleave(t){t.preventDefault(),this.el.classList.remove(x.dropping)}ondrop(t){t.preventDefault(),this.el.classList.remove(x.dropping),t.dataTransfer.types.includes("Files")&&t.dataTransfer.files.length>0&&Promise.all(Array.from(t.dataTransfer.files).map(O)).then((t=>{this.callback(t)}))}};var N=class{constructor(t,e){this.parent=t,this.text=e,this.root=document.createElement("div"),this.root.className=x.questionRoot,this.inner=document.createElement("div"),this.inner.className=x.questionInner,e&&(this.textElement=document.createElement("div"),this.textElement.textContent=e,this.textElement.className=x.questionText),this.inputContainer=document.createElement("div"),this.inputContainer.className=x.questionInputOuter,this.input=document.createElement("input"),this.input.className=x.questionInput,this.input.addEventListener("keypress",this.onkeypress.bind(this)),this.dropper=new M(this.input,this.dropperCallback.bind(this)),this.submitButton=document.createElement("button"),this.submitButton.className=x.questionSubmitButton,this.submitButton.addEventListener("click",this.onsubmitpressclick.bind(this)),this.inputContainer.appendChild(this.input),this.inputContainer.appendChild(this.submitButton),this.textElement&&this.inner.appendChild(this.textElement),this.inner.appendChild(this.inputContainer),this.root.appendChild(this.inner),this.parent._addLayer(this.root),this.input.focus(),this.answerCallback=new Promise((t=>{this.callback=t}))}answer(){return this.answerCallback}submit(){this.callback(this.input.value),this.destroy()}onkeypress(t){"Enter"===t.key&&this.submit()}dropperCallback(t){const e=t.join("").replace(/\r?\n/g," ");this.input.value=e}onsubmitpressclick(){this.submit()}destroy(){this.root.remove(),this.parent.question=null}};var C=class{constructor(t){this.parent=t,this.root=document.createElement("div"),this.root.className=x.contextMenu,this._onmousedown=this._onmousedown.bind(this),this._onresize=this._onresize.bind(this),this._onblur=this._onblur.bind(this)}_onmousedown(t){this.root.contains(t.target)||this.destroy()}_onresize(){this.destroy()}_onblur(){this.destroy()}add(t){const e=document.createElement("button");e.className=x.contextMenuItem,e.textContent=t.text,e.addEventListener("click",(()=>{this.destroy(),t.callback()})),e.addEventListener("contextmenu",(t=>{t.preventDefault()})),this.root.appendChild(e)}show(t){document.addEventListener("mousedown",this._onmousedown),window.addEventListener("resize",this._onresize),window.addEventListener("blur",this._onblur),this.parent._addLayer(this.root);const e=this.parent.layersRect,n=this.root.getBoundingClientRect();let r=t.clientX-e.left,i=t.clientY-e.top;r+n.width>e.width&&(r-=n.width),i+n.height>e.height&&(i-=n.height),this.root.style.transform="translate(".concat(r,"px, ").concat(i,"px)"),getComputedStyle(this.root).opacity,this.root.style.opacity="1"}destroy(){document.removeEventListener("mousedown",this._onmousedown),window.removeEventListener("resize",this._onresize),window.removeEventListener("blur",this._onblur),this.root.style.opacity="0",this.root.style.pointerEvents="none",setTimeout((()=>{this.root.remove()}),200)}};var R=(t,e)=>{if("undefined"!=typeof ExternalDownloadHelper)return void ExternalDownloadHelper.download(t,e);const n=document.createElement("a");if(document.body.appendChild(n),navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(e,t);else if("download"in HTMLAnchorElement.prototype){const r=window.URL.createObjectURL(e);n.href=r,n.download=t,n.type=e.type,n.click(),window.setTimeout((()=>{document.body.removeChild(n),window.URL.revokeObjectURL(r)}),1e3)}else{let t=window.open("","_blank");const n=new FileReader;n.onloadend=function(){t.location.href=n.result,t=null},n.readAsDataURL(e)}};class D{constructor(t,e){this.parent=t,this.id=e.get("id"),this.spriteName=e.get("spriteName"),this.targetId=e.get("targetId"),this.opcode=e.get("opcode"),this.params=e.get("params"),this.root=document.createElement("div"),this.root.className=x.monitorRoot,this.root.dataset.id=this.id,this.root.dataset.opcode=this.opcode,this.parent._monitorOverlay.appendChild(this.root)}getLabel(){let t;if("data_variable"===this.opcode)t=this.params.VARIABLE;else if("data_listcontents"===this.opcode)t=this.params.LIST;else if("motion_xposition"===this.opcode)t=this.parent.getMessage("var-x");else if("motion_yposition"===this.opcode)t=this.parent.getMessage("var-y");else if("motion_direction"===this.opcode)t=this.parent.getMessage("var-direction");else if("sensing_username"===this.opcode)t=this.parent.getMessage("var-username");else if("looks_costumenumbername"===this.opcode)t="number"===this.params.NUMBER_NAME?this.parent.getMessage("var-costume-number"):this.parent.getMessage("var-costume-name");else if("looks_backdropnumbername"===this.opcode)t="number"===this.params.NUMBER_NAME?this.parent.getMessage("var-backdrop-number"):this.parent.getMessage("var-backdrop-name");else if("looks_size"===this.opcode)t=this.parent.getMessage("var-size");else if("sensing_answer"===this.opcode)t=this.parent.getMessage("var-answer");else if("sensing_mousedown"===this.opcode)t=this.parent.getMessage("var-mousedown");else if("sensing_mousex"===this.opcode)t=this.parent.getMessage("var-mousex");else if("sensing_mousey"===this.opcode)t=this.parent.getMessage("var-mousey");else if("sensing_loudness"===this.opcode)t=this.parent.getMessage("var-loudness");else if("sensing_timer"===this.opcode)t=this.parent.getMessage("var-timer");else if("sensing_dayssince2000"===this.opcode)t=this.parent.getMessage("var-dayssince2000");else if("sound_volume"===this.opcode)t=this.parent.getMessage("var-volume");else if("sensing_current"===this.opcode){const e=this.params.CURRENTMENU.toLowerCase();"year"===e?t=this.parent.getMessage("var-year"):"month"===e?t=this.parent.getMessage("var-month"):"date"===e?t=this.parent.getMessage("var-date"):"dayofweek"===e?t=this.parent.getMessage("var-day-of-week"):"hour"===e?t=this.parent.getMessage("var-hour"):"minute"===e?t=this.parent.getMessage("var-minute"):"second"===e&&(t=this.parent.getMessage("var-second"))}else{const e=this.parent.vm.runtime.getLabelForOpcode(this.opcode);t=e?e.label:this.opcode}return this.spriteName?"".concat(this.spriteName,": ").concat(t):t}getTarget(){return this.targetId?this.parent.vm.runtime.getTargetById(this.targetId):this.parent.vm.runtime.getTargetForStage()}getVmVariable(){return this.getTarget().variables[this.id]}update(t){this.x=t.get("x"),this.y=t.get("y"),this.visible=t.get("visible"),this.root.style.transform="translate(".concat(Math.round(this.x),"px, ").concat(Math.round(this.y),"px)"),this.root.style.display=this.visible?"":"none"}}class P extends D{constructor(t,e){super(t,e),this.mode=e.get("mode"),"large"===this.mode?(this.valueElement=document.createElement("div"),this.valueElement.className=x.monitorLargeValue+" "+x.monitorValueColor,this.root.appendChild(this.valueElement)):(this.inner=document.createElement("div"),this.inner.className=x.monitorInner,this.valueRow=document.createElement("div"),this.valueRow.className=x.monitorRow,this.label=document.createElement("div"),this.label.className=x.monitorLabel,this.label.textContent=this.getLabel(),this.valueElement=document.createElement("div"),this.valueElement.className=x.monitorValue+" "+x.monitorValueColor,this.valueRow.appendChild(this.label),this.valueRow.appendChild(this.valueElement),this.inner.appendChild(this.valueRow),"slider"===this.mode&&(this.sliderRow=document.createElement("div"),this.sliderRow.className=x.monitorRow,this.slider=document.createElement("input"),this.slider.className=x.monitorSlider,this.slider.type="range",this.slider.min=e.get("sliderMin"),this.slider.max=e.get("sliderMax"),this.slider.step=e.get("isDiscrete")?1:.01,this.slider.addEventListener("input",this.onsliderchange.bind(this)),this.sliderRow.appendChild(this.slider),this.inner.appendChild(this.sliderRow)),this.root.appendChild(this.inner)),this.parent._monitorOverlay.appendChild(this.root),this._value=""}setVariableValue(t){const e=this.getVmVariable();if(e.value=t,e.isCloud){this.parent.vm.runtime.ioDevices.cloud.requestUpdateVariable(e.name,e.value)}this._value=t,this.valueElement.textContent=t}onsliderchange(t){this.setVariableValue(+t.target.value)}update(t){if(super.update(t),!this.visible)return;let e=t.get("value");"number"==typeof e&&(e=Number(e.toFixed(6))),this._value!==e&&(this._value=e,this.valueElement.textContent=e,this.slider&&(this.slider.value=e))}}class L{constructor(t){this.monitor=t,this.index=-1,this.value="",this.isFocused=!1,this.root=document.createElement("label"),this.root.className=x.monitorRowRoot,this.indexEl=document.createElement("div"),this.indexEl.className=x.monitorRowIndex,this.valueOuter=document.createElement("div"),this.valueOuter.className=x.monitorRowValueOuter,this.editable=this.monitor.editable,this.editable?(this.valueInner=document.createElement("input"),this.valueInner.className=x.monitorRowValueInner,this.valueInner.addEventListener("focusin",this._onfocusin.bind(this)),this.valueInner.addEventListener("focusout",this._onfocusout.bind(this)),this.valueInner.addEventListener("keypress",this._onkeypress.bind(this)),this.valueInner.addEventListener("keydown",this._onkeydown.bind(this)),this.valueInner.addEventListener("input",this._oninput.bind(this)),this.valueOuter.appendChild(this.valueInner),this.deleteButton=document.createElement("button"),this.deleteButton.className=x.monitorRowDelete,this.deleteButton.textContent="×",this.deleteButton.addEventListener("mousedown",this._onclickdelete.bind(this)),this.valueOuter.appendChild(this.deleteButton)):(this.valueInner=document.createElement("div"),this.valueInner.className=x.monitorRowValueInner,this.valueOuter.appendChild(this.valueInner)),this.valueInner.addEventListener("contextmenu",this._oncontextmenu.bind(this)),this.root.appendChild(this.indexEl),this.root.appendChild(this.valueOuter)}isLocked(){return this.isFocused}_onfocusin(){this.isFocused||(this.isFocused=!0,this.valueInner.select(),this.root.classList.add(x.monitorRowValueEditing),this.addNewValue=!1,this.deleteValue=!1,this.valueWasChanged=!1)}_onfocusout(){if(this.isFocused)if(this.value=this.valueInner.value,this.isFocused=!1,this.root.classList.remove(x.monitorRowValueEditing),this.deleteValue){const t=[...this.monitor.value];t.splice(this.index,1),this.monitor.setValue(t),this.monitor.tryToFocusRow(Math.min(t.length-1,this.index))}else if(this.valueWasChanged||this.addNewValue){const t=[...this.monitor.value];t[this.index]=this.value,this.addNewValue&&t.splice(this.index+1,0,""),this.monitor.setValue(t),this.addNewValue&&this.monitor.tryToFocusRow(this.index+1)}}_oninput(){this.valueWasChanged=!0}_onkeypress(t){"Enter"===t.key&&(this.addNewValue=!0,this.valueInner.blur())}_onkeydown(t){if("Escape"===t.key)this.valueInner.blur();else if("ArrowUp"===t.key||"ArrowDown"===t.key||"Tab"===t.key){t.preventDefault();let e=this.index;"ArrowUp"===t.key||"Tab"===t.key&&t.shiftKey?(e--,e<0&&(e=this.monitor.value.length-1)):(e++,e>=this.monitor.value.length&&(e=0)),this.monitor.tryToFocusRow(e)}}_onclickdelete(t){t.preventDefault(),this.deleteValue=!0,this.valueInner.blur()}_oncontextmenu(t){if(this.editable)t.stopPropagation();else{const e=getSelection();this.valueInner.contains(e.anchorNode)&&!e.isCollapsed&&t.stopPropagation()}}setIndex(t){this.index!==t&&(this.index=t,this.root.dataset.index=t,this.root.style.transform="translateY(".concat(24*t,"px)"),this.indexEl.textContent=t+1)}setValue(t){this.value===t||this.isFocused||(this.value=t,this.editable?this.valueInner.value=t:this.valueInner.textContent=t)}focus(){this.isFocused||this.valueInner.focus()}unfocus(){this.isFocused&&this.valueInner.blur()}}class B extends D{constructor(t,e){super(t,e),this.editable=t.editableLists,this.rows=new Map,this.cachedRows=[],this.scrollTop=0,this.oldLength=-1,this.label=document.createElement("div"),this.label.className=x.monitorListLabel,this.label.textContent=this.getLabel(),this.footer=document.createElement("div"),this.footer.className=x.monitorListFooter,this.footerText=document.createElement("div"),this.footerText.className=x.monitorListFooterText,this.rowsOuter=document.createElement("div"),this.rowsOuter.className=x.monitorRowsOuter,this.rowsInner=document.createElement("div"),this.rowsInner.className=x.monitorRowsInner,this.rowsInner.addEventListener("scroll",this._onscroll.bind(this),{passive:!0}),this.endPoint=document.createElement("div"),this.endPoint.className=x.monitorRowsEndpoint,this.emptyLabel=document.createElement("div"),this.emptyLabel.textContent=t.getMessage("list-empty"),this.emptyLabel.className=x.monitorEmpty,this.editable&&(this.addButton=document.createElement("button"),this.addButton.className=x.monitorListAdd,this.addButton.textContent="+",this.addButton.addEventListener("click",this._onclickaddbutton.bind(this)),this.footer.appendChild(this.addButton)),this.rowsInner.appendChild(this.endPoint),this.rowsInner.appendChild(this.emptyLabel),this.rowsOuter.appendChild(this.rowsInner),this.footer.appendChild(this.footerText),this.root.appendChild(this.label),this.root.appendChild(this.rowsOuter),this.root.appendChild(this.footer),this.dropper=new M(this.rowsOuter,this.dropperCallback.bind(this)),this.handleImport=this.handleImport.bind(this),this.handleExport=this.handleExport.bind(this),this.root.addEventListener("contextmenu",this._oncontextmenu.bind(this))}_onclickaddbutton(t){this.setValue([...this.value,""]),this.tryToFocusRow(this.value.length-1)}unfocusAllRows(){for(const t of this.rows.values())t.unfocus()}tryToFocusRow(t){if(t>=0&&t<this.value.length){this.unfocusAllRows();let e=this.rows.get(t);e||(e=this.createRow(t)),e.focus()}}_onscroll(t){this.scrollTop=t.target.scrollTop,this.updateValue(this.value)}_oncontextmenu(t){t.preventDefault();const e=new C(this.parent);e.add({text:this.parent.getMessage("list-import"),callback:this.handleImport}),e.add({text:this.parent.getMessage("list-export"),callback:this.handleExport}),e.show(t)}handleImport(){const t=document.createElement("input");t.type="file",t.accept=".txt,.csv,.tsv",t.style.display="none",document.body.appendChild(t),t.addEventListener("change",(t=>{const e=t.target.files;if(0===e.length)return;const n=e[0];O(n).then((t=>this.import(t)))})),t.click()}import(t){const e=t.split(/\r?\n/);this.setValue(e)}handleExport(){const t=this.getValue().join("\n"),e=new Blob([t],{type:"text/plain"});R("".concat(this.getLabel(),".txt"),e)}dropperCallback(t){this.import(t.join("\n"))}getValue(){return this.getVmVariable().value}setValue(t){this.getVmVariable().value=t,this.updateValue(t)}update(t){super.update(t),this.visible&&(this.width=t.get("width")||100,this.height=t.get("height")||200,this.root.style.width="".concat(this.width,"px"),this.root.style.height="".concat(this.height,"px"),this.updateValue(t.get("value")))}createRow(t){const e=this.cachedRows.pop()||new L(this);e.setIndex(t),e.setValue(this.value[t]),this.rows.set(t,e);let n=!1;for(const r of this.rowsInner.children){const i=r.dataset.index;if(!i)continue;if(+i>t){this.rowsInner.insertBefore(e.root,r),n=!0;break}}return n||this.rowsInner.appendChild(e.root),e}updateValue(t){this.value=t,t.length!==this.oldLength&&(this.oldLength=t.length,this.footerText.textContent=this.parent.getMessage("list-length").replace("{n}",t.length),this.endPoint.style.transform="translateY(".concat(24*t.length,"px)"),this.emptyLabel.style.display=t.length?"none":"");let e=Math.floor(this.scrollTop/24)-5;e<0&&(e=0);let n=Math.ceil((this.scrollTop+this.height)/24)+3;n>t.length-1&&(n=t.length-1);for(const r of this.rows.keys())if(r<e||r>n){const e=this.rows.get(r);(!e.isLocked()||r>=t.length)&&(e.unfocus(),e.root.remove(),this.rows.delete(r),this.cachedRows.length<10&&this.cachedRows.push(e))}for(let r=e;r<=n;r++){const e=this.rows.get(r);e?e.setValue(t[r]):this.createRow(r)}}}var U=class{constructor(){this.hasItem=!1,this.root=document.createElement("div"),this.root.className=x.controlsBar,this.start=document.createElement("div"),this.end=document.createElement("div"),this.root.appendChild(this.start),this.root.appendChild(this.end)}addToStart(t){this.hasItem=!0,this.start.appendChild(t)}addToEnd(t){this.hasItem=!0,this.end.appendChild(t)}computeHeight(){return this.hasItem?this.root.getBoundingClientRect().height:0}};const j=t=>"number"==typeof t||"string"==typeof t||"boolean"==typeof t;var F=n(96);const z=t=>t.touches&&t.touches[0]?{x:t.touches[0].clientX,y:t.touches[0].clientY}:t.changedTouches&&t.changedTouches[0]?{x:t.changedTouches[0].clientX,y:t.changedTouches[0].clientY}:{x:t.clientX,y:t.clientY},V=t=>"function"==typeof t?t:()=>t;class G extends b{constructor(){super(),this.width=480,this.height=360,this.resizeMode="preserve-ratio",this.editableLists=!1,this.shouldConnectPeripherals=!0,this.usePackagedRuntime=!1,this.messages=F,this._monitors=new Map,this._mousedownPosition=null,this._draggingId=null,this._draggingStartMousePosition=null,this._draggingStartSpritePosition=null,this._offsetFromTop=0,this._offsetFromBottom=0,this._offsetFromLeft=0,this._offsetFromRight=0,this._root=document.createElement("div"),this._root.className=x.root,this._layers=document.createElement("div"),this._layers.className=x.layers,this._root.appendChild(this._layers),this._canvas=document.createElement("canvas"),this._canvas.className=x.canvas,this._addLayer(this._canvas),this._overlays=document.createElement("div"),this._overlays.className=x.scaledOverlaysInner,this._overlaysOuter=document.createElement("div"),this._overlaysOuter.className=x.scaledOverlaysOuter,this._overlaysOuter.appendChild(this._overlays),this._addLayer(this._overlaysOuter),this._monitorOverlay=document.createElement("div"),this._monitorOverlay.className=x.monitorOverlay,this._overlays.appendChild(this._monitorOverlay),this._topControls=new U,this._layers.appendChild(this._topControls.root),document.addEventListener("mousemove",this._onmousemove.bind(this)),this._canvas.addEventListener("mousedown",this._onmousedown.bind(this)),document.addEventListener("mouseup",this._onmouseup.bind(this)),this._canvas.addEventListener("touchstart",this._ontouchstart.bind(this)),document.addEventListener("touchmove",this._ontouchmove.bind(this)),document.addEventListener("touchend",this._ontouchend.bind(this)),this._canvas.addEventListener("contextmenu",this._oncontextmenu.bind(this)),this._canvas.addEventListener("wheel",this._onwheel.bind(this)),document.addEventListener("keydown",this._onkeydown.bind(this)),document.addEventListener("keyup",this._onkeyup.bind(this)),window.addEventListener("resize",this._onresize.bind(this))}_addLayer(t){this._layers.appendChild(t)}_scratchCoordinates(t,e){return{x:this.width/this.layersRect.width*(t-this.layersRect.width/2),y:-this.height/this.layersRect.height*(e-this.layersRect.height/2)}}_onmousemove(t){const{x:e,y:n}=z(t),r={x:e-this.layersRect.left,y:n-this.layersRect.top,canvasWidth:this.layersRect.width,canvasHeight:this.layersRect.height};if(this._mousedownPosition&&!this._draggingId){Math.sqrt(Math.pow(r.x-this._mousedownPosition.x,2)+Math.pow(r.y-this._mousedownPosition.y,2))>3&&(this._startDragging(r.x,r.y),this._cancelDragTimeout())}else if(this._draggingId){const t=this._scratchCoordinates(r.x,r.y);this.vm.postSpriteInfo({x:t.x-this._draggingStartMousePosition.x+this._draggingStartSpritePosition.x,y:t.y-this._draggingStartMousePosition.y+this._draggingStartSpritePosition.y,force:!0})}this.vm.postIOData("mouse",r)}_startDragging(t,e){if(this._draggingId)return;const n=this.renderer.pick(t,e);if(-1===n||!1===n)return;const r=this.vm.getTargetIdForDrawableId(n);if(null===r)return;const i=this.vm.runtime.getTargetById(r);i.draggable&&(i.goToFront(),this._draggingId=r,this._draggingStartMousePosition=this._scratchCoordinates(t,e),this._draggingStartSpritePosition={x:i.x,y:i.y},this.vm.startDrag(r))}_cancelDragTimeout(){clearTimeout(this._dragTimeout),this._dragTimeout=null}_onmousedown(t){const{x:e,y:n}=z(t),r={x:e-this.layersRect.left,y:n-this.layersRect.top,button:t.button,canvasWidth:this.layersRect.width,canvasHeight:this.layersRect.height,isDown:!0},i="undefined"!=typeof TouchEvent&&t instanceof TouchEvent;(0===t.button||i)&&(this._dragTimeout=setTimeout(this._startDragging.bind(this,r.x,r.y),400)),i&&(t.preventDefault(),document.activeElement&&document.activeElement.blur&&document.activeElement.blur()),this._mousedownPosition={x:r.x,y:r.y},this.vm.postIOData("mouse",r)}_onmouseup(t){this._cancelDragTimeout();const{x:e,y:n}=z(t),r={x:e-this.layersRect.left,y:n-this.layersRect.top,button:t.button,canvasWidth:this.layersRect.width,canvasHeight:this.layersRect.height,isDown:!1,wasDragged:null!==this._draggingId};this._mousedownPosition=null,this.vm.postIOData("mouse",r),this._draggingId&&(this.vm.stopDrag(this._draggingId),this._draggingStartMousePosition=null,this._draggingStartSpritePosition=null,this._draggingId=null)}_ontouchstart(t){this._onmousedown(t)}_ontouchmove(t){this._onmousemove(t)}_ontouchend(t){this._onmouseup(t)}_oncontextmenu(t){t.preventDefault()}_onwheel(t){const e={deltaX:t.deltaX,deltaY:t.deltaY};this.vm.postIOData("mouseWheel",e)}_onkeydown(t){if(t.target!==document&&t.target!==document.body)return;const e={key:t.key,keyCode:t.keyCode,isDown:!0};this.vm.postIOData("keyboard",e),(32===t.keyCode||t.keyCode>=37&&t.keyCode<=40||8===t.keyCode||222===t.keyCode||191===t.keyCode)&&t.preventDefault()}_onkeyup(t){const e={key:t.key,keyCode:t.keyCode,isDown:!1};this.vm.postIOData("keyboard",e),t.target!==document&&t.target!==document.body&&t.preventDefault()}_onresize(){this.relayout()}relayout(){const t=Math.max(1,this._root.offsetWidth),e=Math.max(1,this._root.offsetHeight),n=this._offsetFromTop+this._topControls.computeHeight(),r=this._offsetFromBottom,i=this._offsetFromLeft,s=this._offsetFromRight,o=Math.max(1,t-i-s),a=Math.max(1,e-n-r);"dynamic-resize"===this.resizeMode&&(this.vm.setStageSize?(this.width=o,this.height=a,this.vm.setStageSize(this.width,this.height)):console.warn("dynamic-resize not supported: vm does not implement setStageSize"));let c=o,u=a;"stretch"!==this.resizeMode&&(c=u/this.height*this.width,c>o&&(u=o/this.width*this.height,c=o));const l=e-u,h=t-c,d=(h-i-s)/2+i-h/2,p=(l-n-r)/2+n-l/2;this._layers.style.transform="translate(".concat(d,"px, ").concat(p,"px)"),this._layers.style.width="".concat(c,"px"),this._layers.style.height="".concat(u,"px"),this._overlays.style.transform="scale(".concat(c/this.width,", ").concat(u/this.height,")"),this.renderer.resize(c,u),this.layersRect=this._layers.getBoundingClientRect()}appendTo(t){t.appendChild(this._root),this.relayout()}setup(){this.vm=new a.a,this.vm.setCompatibilityMode(!0),this.vm.setLocale(navigator.language),this.vm.on("MONITORS_UPDATE",this._onmonitorsupdate.bind(this)),this.vm.runtime.on("QUESTION",this._onquestion.bind(this)),this.vm.on("PROJECT_RUN_START",(()=>this.dispatchEvent(new Event("PROJECT_RUN_START")))),this.vm.on("PROJECT_RUN_STOP",(()=>this.dispatchEvent(new Event("PROJECT_RUN_STOP")))),this.usePackagedRuntime&&this.vm.convertToPackagedRuntime&&this.vm.convertToPackagedRuntime(),this.vm.setStageSize&&this.vm.setStageSize(this.width,this.height),this.vm.runtime.cloudOptions&&(this.vm.runtime.cloudOptions.limit=1/0),this.vm.on("STAGE_SIZE_CHANGED",((t,e)=>{this.width===t&&this.height===e||(this.width=t,this.height=e,this.relayout())})),this.cloudManager=new E.CloudManager(this),this.renderer=new u.a(this._canvas,-this.width/2,this.width/2,-this.height/2,this.height/2),this.vm.attachRenderer(this.renderer),this.renderer.overlayContainer&&this._layers.insertBefore(this.renderer.overlayContainer,this._overlaysOuter),this.storage=new g,this.vm.attachStorage(this.storage),"undefined"!=typeof AudioContext||"undefined"!=typeof webkitAudioContext?(this.audioEngine=new p.a,this.vm.attachAudioEngine(this.audioEngine)):console.warn("AudioContext not supported. Sound will not work."),this.bitmapAdapter=new f.BitmapAdapter,this.vm.attachV2BitmapAdapter(this.bitmapAdapter),this.videoProvider=new T,this.vm.setVideoProvider(this.videoProvider)}async _connectPeripherals(){const t=t=>new Promise((e=>{const n=e=>{const n=Object.keys(e).map((t=>e[t]));if(n.length>0){const e=n[0];console.log("Connecting to peripheral",e),this.vm.connectPeripheral(t,e.peripheralId)}else console.error("No peripherals found for",t);i()},r=()=>{console.error("Peripheral scan timed out for",t),i()},i=()=>{this.vm.removeListener("PERIPHERAL_LIST_UPDATE",n),this.vm.removeListener("PERIPHERAL_SCAN_TIMEOUT",r),e()};this.vm.on("PERIPHERAL_LIST_UPDATE",n),this.vm.on("PERIPHERAL_SCAN_TIMEOUT",r),this.vm.scanForPeripheral(t)}));for(const e of Object.keys(this.vm.runtime.peripheralExtensions))await t(e)}_onmonitorsupdate(t){for(const e of t.valueSeq()){const t=e.get("id");if(!this._monitors.has(t)){if(!e.get("visible"))continue;"list"===e.get("mode")?this._monitors.set(t,new B(this,e)):this._monitors.set(t,new P(this,e))}this._monitors.get(t).update(e)}}ask(t){return this._question=new N(this,t),this._question.answer()}_onquestion(t){this._question&&this._question.destroy(),null!==t&&this.ask(t).then((t=>{this.vm.runtime.emit("ANSWER",t)}))}loadProject(t){return this.vm.loadProject(t).then((()=>{this.vm.setCloudProvider(this.cloudManager),this.cloudManager.projectReady(),this.renderer.draw(),setTimeout((()=>{this.renderer.draw()})),this.shouldConnectPeripherals&&this._connectPeripherals()}))}setUsername(t){this._username=t,this.vm.postIOData("userData",{username:t})}addCloudProvider(t){this.cloudManager.addProvider(t)}addCloudProviderOverride(t,e){this.cloudManager.addProviderOverride(t,e)}addControlButton(t){let{element:e,where:n}=t;if("top-left"===n)this._topControls.addToStart(e);else{if("top-right"!==n)throw new Error("Unknown 'where': ".concat(n));this._topControls.addToEnd(e)}this.relayout()}getMessage(t){return this.messages[t]||t}setAccentColor(t){this._root.style.setProperty("--sc-accent-color",t),this._root.style.setProperty("--sc-accent-color-transparent","".concat(t,"59"))}start(){this.vm.start(),this.vm.greenFlag()}greenFlag(){this.start()}stopAll(){this.vm.stopAll()}_lookupVariable(t,e){const n=this.vm.runtime.getTargetForStage().lookupVariableByNameAndType(t,e);if(!n)throw new Error("Global ".concat(e||"variable"," does not exist: ").concat(t));return n}setExtensionSecurityManager(t){const e=this.vm.extensionManager.securityManager;if(e)for(const[n,r]of Object.entries(t))e[n]=V(r);else console.warn("setExtensionSecurityManager not supported: there is no security manager")}getVariable(t){return this._lookupVariable(t,"").value}setVariable(t,e){if(!j(e))throw new Error("Invalid variable value");this._lookupVariable(t,"").value=e}getList(t){return this._lookupVariable(t,"list").value}setList(t,e){if(!(t=>{if(!Array.isArray(t))return!1;for(let e=0;e<t.length;e++)if(!j(t[e]))return!1;return!0})(e))throw new Error("Invalid list value");this._lookupVariable(t,"list").value=e}}if(window.Scaffolding)throw new Error("Scaffolding already exists on this page");window.Scaffolding=r},function(t,e,n){"use strict";var r;n.r(e),n.d(e,"v1",(function(){return m})),n.d(e,"v3",(function(){return I})),n.d(e,"v4",(function(){return S})),n.d(e,"v5",(function(){return M})),n.d(e,"NIL",(function(){return N})),n.d(e,"version",(function(){return C})),n.d(e,"validate",(function(){return a})),n.d(e,"stringify",(function(){return d})),n.d(e,"parse",(function(){return g}));var i=new Uint8Array(16);function s(){if(!r&&!(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(i)}var o=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var a=function(t){return"string"==typeof t&&o.test(t)},c=[],u=0;u<256;++u)c.push((u+256).toString(16).substr(1));var l,h,d=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(c[t[e+0]]+c[t[e+1]]+c[t[e+2]]+c[t[e+3]]+"-"+c[t[e+4]]+c[t[e+5]]+"-"+c[t[e+6]]+c[t[e+7]]+"-"+c[t[e+8]]+c[t[e+9]]+"-"+c[t[e+10]]+c[t[e+11]]+c[t[e+12]]+c[t[e+13]]+c[t[e+14]]+c[t[e+15]]).toLowerCase();if(!a(n))throw TypeError("Stringified UUID is invalid");return n},p=0,f=0;var m=function(t,e,n){var r=e&&n||0,i=e||new Array(16),o=(t=t||{}).node||l,a=void 0!==t.clockseq?t.clockseq:h;if(null==o||null==a){var c=t.random||(t.rng||s)();null==o&&(o=l=[1|c[0],c[1],c[2],c[3],c[4],c[5]]),null==a&&(a=h=16383&(c[6]<<8|c[7]))}var u=void 0!==t.msecs?t.msecs:Date.now(),m=void 0!==t.nsecs?t.nsecs:f+1,g=u-p+(m-f)/1e4;if(g<0&&void 0===t.clockseq&&(a=a+1&16383),(g<0||u>p)&&void 0===t.nsecs&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");p=u,f=m,h=a;var b=(1e4*(268435455&(u+=122192928e5))+m)%4294967296;i[r++]=b>>>24&255,i[r++]=b>>>16&255,i[r++]=b>>>8&255,i[r++]=255&b;var y=u/4294967296*1e4&268435455;i[r++]=y>>>8&255,i[r++]=255&y,i[r++]=y>>>24&15|16,i[r++]=y>>>16&255,i[r++]=a>>>8|128,i[r++]=255&a;for(var v=0;v<6;++v)i[r+v]=o[v];return e||d(i)};var g=function(t){if(!a(t))throw TypeError("Invalid UUID");var e,n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=255&e,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=255&e,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=255&e,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=255&e,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=255&e,n};var b=function(t,e,n){function r(t,r,i,s){if("string"==typeof t&&(t=function(t){t=unescape(encodeURIComponent(t));for(var e=[],n=0;n<t.length;++n)e.push(t.charCodeAt(n));return e}(t)),"string"==typeof r&&(r=g(r)),16!==r.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var o=new Uint8Array(16+t.length);if(o.set(r),o.set(t,r.length),(o=n(o))[6]=15&o[6]|e,o[8]=63&o[8]|128,i){s=s||0;for(var a=0;a<16;++a)i[s+a]=o[a];return i}return d(o)}try{r.name=t}catch(t){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r};function y(t){return 14+(t+64>>>9<<4)+1}function v(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function w(t,e,n,r,i,s){return v((o=v(v(e,t),v(r,s)))<<(a=i)|o>>>32-a,n);var o,a}function T(t,e,n,r,i,s,o){return w(e&n|~e&r,t,e,i,s,o)}function E(t,e,n,r,i,s,o){return w(e&r|n&~r,t,e,i,s,o)}function A(t,e,n,r,i,s,o){return w(e^n^r,t,e,i,s,o)}function k(t,e,n,r,i,s,o){return w(n^(e|~r),t,e,i,s,o)}var I=b("v3",48,(function(t){if("string"==typeof t){var e=unescape(encodeURIComponent(t));t=new Uint8Array(e.length);for(var n=0;n<e.length;++n)t[n]=e.charCodeAt(n)}return function(t){for(var e=[],n=32*t.length,r="0123456789abcdef",i=0;i<n;i+=8){var s=t[i>>5]>>>i%32&255,o=parseInt(r.charAt(s>>>4&15)+r.charAt(15&s),16);e.push(o)}return e}(function(t,e){t[e>>5]|=128<<e%32,t[y(e)-1]=e;for(var n=1732584193,r=-271733879,i=-1732584194,s=271733878,o=0;o<t.length;o+=16){var a=n,c=r,u=i,l=s;n=T(n,r,i,s,t[o],7,-680876936),s=T(s,n,r,i,t[o+1],12,-389564586),i=T(i,s,n,r,t[o+2],17,606105819),r=T(r,i,s,n,t[o+3],22,-1044525330),n=T(n,r,i,s,t[o+4],7,-176418897),s=T(s,n,r,i,t[o+5],12,1200080426),i=T(i,s,n,r,t[o+6],17,-1473231341),r=T(r,i,s,n,t[o+7],22,-45705983),n=T(n,r,i,s,t[o+8],7,1770035416),s=T(s,n,r,i,t[o+9],12,-1958414417),i=T(i,s,n,r,t[o+10],17,-42063),r=T(r,i,s,n,t[o+11],22,-1990404162),n=T(n,r,i,s,t[o+12],7,1804603682),s=T(s,n,r,i,t[o+13],12,-40341101),i=T(i,s,n,r,t[o+14],17,-1502002290),n=E(n,r=T(r,i,s,n,t[o+15],22,1236535329),i,s,t[o+1],5,-165796510),s=E(s,n,r,i,t[o+6],9,-1069501632),i=E(i,s,n,r,t[o+11],14,643717713),r=E(r,i,s,n,t[o],20,-373897302),n=E(n,r,i,s,t[o+5],5,-701558691),s=E(s,n,r,i,t[o+10],9,38016083),i=E(i,s,n,r,t[o+15],14,-660478335),r=E(r,i,s,n,t[o+4],20,-405537848),n=E(n,r,i,s,t[o+9],5,568446438),s=E(s,n,r,i,t[o+14],9,-1019803690),i=E(i,s,n,r,t[o+3],14,-187363961),r=E(r,i,s,n,t[o+8],20,1163531501),n=E(n,r,i,s,t[o+13],5,-1444681467),s=E(s,n,r,i,t[o+2],9,-51403784),i=E(i,s,n,r,t[o+7],14,1735328473),n=A(n,r=E(r,i,s,n,t[o+12],20,-1926607734),i,s,t[o+5],4,-378558),s=A(s,n,r,i,t[o+8],11,-2022574463),i=A(i,s,n,r,t[o+11],16,1839030562),r=A(r,i,s,n,t[o+14],23,-35309556),n=A(n,r,i,s,t[o+1],4,-1530992060),s=A(s,n,r,i,t[o+4],11,1272893353),i=A(i,s,n,r,t[o+7],16,-155497632),r=A(r,i,s,n,t[o+10],23,-1094730640),n=A(n,r,i,s,t[o+13],4,681279174),s=A(s,n,r,i,t[o],11,-358537222),i=A(i,s,n,r,t[o+3],16,-722521979),r=A(r,i,s,n,t[o+6],23,76029189),n=A(n,r,i,s,t[o+9],4,-640364487),s=A(s,n,r,i,t[o+12],11,-421815835),i=A(i,s,n,r,t[o+15],16,530742520),n=k(n,r=A(r,i,s,n,t[o+2],23,-995338651),i,s,t[o],6,-198630844),s=k(s,n,r,i,t[o+7],10,1126891415),i=k(i,s,n,r,t[o+14],15,-1416354905),r=k(r,i,s,n,t[o+5],21,-57434055),n=k(n,r,i,s,t[o+12],6,1700485571),s=k(s,n,r,i,t[o+3],10,-1894986606),i=k(i,s,n,r,t[o+10],15,-1051523),r=k(r,i,s,n,t[o+1],21,-2054922799),n=k(n,r,i,s,t[o+8],6,1873313359),s=k(s,n,r,i,t[o+15],10,-30611744),i=k(i,s,n,r,t[o+6],15,-1560198380),r=k(r,i,s,n,t[o+13],21,1309151649),n=k(n,r,i,s,t[o+4],6,-145523070),s=k(s,n,r,i,t[o+11],10,-1120210379),i=k(i,s,n,r,t[o+2],15,718787259),r=k(r,i,s,n,t[o+9],21,-343485551),n=v(n,a),r=v(r,c),i=v(i,u),s=v(s,l)}return[n,r,i,s]}(function(t){if(0===t.length)return[];for(var e=8*t.length,n=new Uint32Array(y(e)),r=0;r<e;r+=8)n[r>>5]|=(255&t[r/8])<<r%32;return n}(t),8*t.length))}));var S=function(t,e,n){var r=(t=t||{}).random||(t.rng||s)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(var i=0;i<16;++i)e[n+i]=r[i];return e}return d(r)};function x(t,e,n,r){switch(t){case 0:return e&n^~e&r;case 1:case 3:return e^n^r;case 2:return e&n^e&r^n&r}}function O(t,e){return t<<e|t>>>32-e}var M=b("v5",80,(function(t){var e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof t){var r=unescape(encodeURIComponent(t));t=[];for(var i=0;i<r.length;++i)t.push(r.charCodeAt(i))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var s=t.length/4+2,o=Math.ceil(s/16),a=new Array(o),c=0;c<o;++c){for(var u=new Uint32Array(16),l=0;l<16;++l)u[l]=t[64*c+4*l]<<24|t[64*c+4*l+1]<<16|t[64*c+4*l+2]<<8|t[64*c+4*l+3];a[c]=u}a[o-1][14]=8*(t.length-1)/Math.pow(2,32),a[o-1][14]=Math.floor(a[o-1][14]),a[o-1][15]=8*(t.length-1)&4294967295;for(var h=0;h<o;++h){for(var d=new Uint32Array(80),p=0;p<16;++p)d[p]=a[h][p];for(var f=16;f<80;++f)d[f]=O(d[f-3]^d[f-8]^d[f-14]^d[f-16],1);for(var m=n[0],g=n[1],b=n[2],y=n[3],v=n[4],w=0;w<80;++w){var T=Math.floor(w/20),E=O(m,5)+x(T,g,b,y)+v+e[T]+d[w]>>>0;v=y,y=b,b=O(g,30)>>>0,g=m,m=E}n[0]=n[0]+m>>>0,n[1]=n[1]+g>>>0,n[2]=n[2]+b>>>0,n[3]=n[3]+y>>>0,n[4]=n[4]+v>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]})),N="00000000-0000-0000-0000-000000000000";var C=function(t){if(!a(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)}}]);
// 72905fa760b16fa80a85f5efdae41c1c346e5156b789445d71f8db4e912d36d8 =^..^=